I want to create some automation runbooks with PowerShell on Azure using bicep. For that I need some custom modules listed below.
var modules = [
'Microsoft.Graph.Authentication'
'Microsoft.Graph.Groups'
'Microsoft.Graph.Mail'
'Microsoft.Graph.Planner'
'Microsoft.Graph.Teams'
'Microsoft.Graph.Users'
'Microsoft.Graph.Users.Actions'
]
Here is how I create the modules:
resource automationResource 'Microsoft.Automation/automationAccounts@2022-08-08' = {
// Some other properties
resource moduleResources 'modules' = [for module in modules: {
name: module
properties: {
contentLink: {
uri: 'https://www.powershellgallery.com/api/v2/'
}
}
}]
}
When I deploy this to Azure I got next error for all modules:
{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"target": "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Automation/automationAccounts/xxx/modules/Microsoft.Graph.Teams",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'."
}
}
Why won't the modules not be added to the automation account?