Created a ARM template to create a AD Application using deployment scripts in ARM via powershell.
Getting this error
The resource write operation failed to complete successfully, because it reached terminal provisioning state 'failed'
Here is the template
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {
"cliResourceName": "AzAppRegDeploymentScript"
},
"resources": [
{
"type": "Microsoft.Resources/deploymentScripts",
"apiVersion": "2019-10-01-preview",
"name": "[variables('cliResourceName')]",
"location": "[resourceGroup().location]",
"kind": "AzurePowerShell",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/XXXXX-bXXd-4XX5-b&*e-YDTXXYYYYS/resourceGroups/sample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mientity": {}
}
},
"properties": {
"azPowerShellVersion": "9.7",
"timeout": "PT30M",
"scriptContent": "$app = New-AzureADApplication -DisplayName 'app-d'",
"cleanupPreference": "OnSuccess",
"retentionInterval": "P1D"
}
}
]
}
what's the error here? CLI also failing. The user managed identity 'mientity' is provided with a contributor role. and roles mentioned in this https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-script-template#configure-the-minimum-permissions