You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The resource type defined in the Bicep file is [Microsoft.Authorization/policyAssignments](/azure/templates/microsoft.authorization/policyassignments). The Bicep file creates a policy assignment named _audit-vm-managed-disks_.
57
+
The resource type defined in the Bicep file is [Microsoft.Authorization/policyAssignments](/azure/templates/microsoft.authorization/policyassignments).
58
+
59
+
The Bicep file uses three parameters to deploy the policy assignment:
60
+
61
+
-`policyAssignmentName` creates the policy assignment named _audit-vm-managed-disks_.
62
+
-`policyDefinitionID` uses the ID of the built-in policy definition. For reference, the commands to get the ID are in the section to deploy the template.
63
+
-`policyDisplayName` creates a display name that's visible in Azure portal.
57
64
58
65
For more information about Bicep files:
59
66
@@ -117,6 +124,25 @@ The Azure CLI commands use a backslash (`\`) for line continuation to improve re
117
124
118
125
---
119
126
127
+
The following commands display the `policyDefinitionID` parameter's value:
128
+
129
+
# [PowerShell](#tab/azure-powershell)
130
+
131
+
```azurepowershell
132
+
(Get-AzPolicyDefinition |
133
+
Where-Object { $_.Properties.DisplayName -eq 'Audit VMs that do not use managed disks' }).ResourceId
134
+
```
135
+
136
+
# [Azure CLI](#tab/azure-cli)
137
+
138
+
```azurecli
139
+
az policy definition list \
140
+
--query "[?displayName=='Audit VMs that do not use managed disks']".id \
141
+
--output tsv
142
+
```
143
+
144
+
---
145
+
120
146
The following commands deploy the policy definition to your resource group. Replace `<resourceGroupName>` with your resource group name:
121
147
122
148
# [PowerShell](#tab/azure-powershell)
@@ -195,7 +221,7 @@ The output is verbose but resembles the following example:
195
221
196
222
```output
197
223
"description": "Policy assignment to resource group scope created with Bicep file",
0 commit comments