azure-resources/azure-automation-account/automationAccount.json
|
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.43.8.12551", "templateHash": "14309240945891557593" } }, "parameters": { "automationAccountName": { "type": "string", "defaultValue": "[format('aa-{0}', uniqueString(resourceGroup().id))]", "metadata": { "description": "The name of the Automation Account" } }, "rjServicePrincipalId": { "type": "string", "metadata": { "description": "The object ID of the RealmJoin service principal" } }, "assignContributorRole": { "type": "bool", "defaultValue": true, "metadata": { "description": "Whether to assign the Contributor role (set to false if role is already assigned manually)" } }, "contributorRoleId": { "type": "string", "metadata": { "description": "The Contributor role definition ID" } } }, "resources": [ { "type": "Microsoft.Automation/automationAccounts", "apiVersion": "2024-10-23", "name": "[parameters('automationAccountName')]", "location": "[resourceGroup().location]", "identity": { "type": "SystemAssigned" }, "properties": { "sku": { "name": "Basic" }, "publicNetworkAccess": true } }, { "condition": "[parameters('assignContributorRole')]", "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2022-04-01", "scope": "[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName'))]", "name": "[guid(resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName')), parameters('rjServicePrincipalId'), parameters('contributorRoleId'))]", "properties": { "principalId": "[parameters('rjServicePrincipalId')]", "principalType": "ServicePrincipal", "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', parameters('contributorRoleId'))]" }, "dependsOn": [ "[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName'))]" ] } ], "outputs": { "automationAccountId": { "type": "string", "metadata": { "description": "The resource ID of the Automation Account" }, "value": "[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName'))]" }, "automationAccountName": { "type": "string", "metadata": { "description": "The name of the Automation Account" }, "value": "[parameters('automationAccountName')]" }, "automationAccountPrincipalId": { "type": "string", "metadata": { "description": "The principal ID of the Automation Account managed identity" }, "value": "[reference(resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName')), '2024-10-23', 'full').identity.principalId]" } } } |