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
Copy file name to clipboardExpand all lines: articles/governance/policy/assign-policy-azurecli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ The Azure CLI commands use a backslash (`\`) for line continuation to improve re
51
51
52
52
## Create policy assignment
53
53
54
-
Use the following commands to create a new policy assignment for your resource group. This example uses an existing resource group that contains a virtual machine _without_ managed disks. The resource group is the scope for the policy assignment.
54
+
Use the following commands to create a new policy assignment for your resource group. This example uses an existing resource group that contains a virtual machine _without_ managed disks. The resource group is the scope for the policy assignment. This example uses the built-in policy definition [Audit VMs that do not use managed disks](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Compute/VMRequireManagedDisk_Audit.json).
55
55
56
56
Run the following commands and replace `<resourceGroupName>` with your resource group name:
@@ -23,7 +23,7 @@ In this quickstart, you use a Bicep file to create a policy assignment that vali
23
23
24
24
## Review the Bicep file
25
25
26
-
The Bicep file creates a policy assignment for a resource group scope and assigns the built-in policy definition [Audit VMs that do not use managed disks](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Compute/VMRequireManagedDisk_Audit.json). For a list of available built-in policies, see [Azure Policy samples](./samples/index.md).
26
+
The Bicep file creates a policy assignment for a resource group scope and assigns the built-in policy definition [Audit VMs that do not use managed disks](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Compute/VMRequireManagedDisk_Audit.json).
27
27
28
28
Create the following Bicep file as _policy-assignment.bicep_.
For more information, go to [Get-AzResourceProvider](/powershell/module/az.resources/get-azresourceprovider) and [Register-AzResourceProvider](/powershell/module/az.resources/register-azresourceprovider).
104
+
103
105
# [Azure CLI](#tab/azure-cli)
104
106
105
107
```azurecli
@@ -111,6 +113,8 @@ az provider show \
111
113
az provider register --namespace Microsoft.PolicyInsights
112
114
```
113
115
116
+
The Azure CLI commands use a backslash (`\`) for line continuation to improve readability. For more information, go to [az provider](/cli/azure/provider).
117
+
114
118
---
115
119
116
120
The following commands deploy the policy definition to your resource group. Replace `<resourceGroupName>` with your resource group name:
@@ -146,7 +150,7 @@ az deployment group create \
146
150
--template-file policy-assignment.bicep
147
151
```
148
152
149
-
The `rgname` variable uses an expression to get your resource group's name used in the deployment command. The Azure CLI commands use a backslash (`\`) for line continuation to improve readability.
153
+
The `rgname` variable uses an expression to get your resource group's name used in the deployment command.
150
154
151
155
-`name` is the deployment name displayed in the output and in Azure for the resource group's deployments.
152
156
-`resource-group` is the name of your resource group where the policy is assigned.
For more information, go to [Get-AzResourceProvider](/powershell/module/az.resources/get-azresourceprovider) and [Register-AzResourceProvider](/powershell/module/az.resources/register-azresourceprovider).
49
+
48
50
## Create policy assignment
49
51
50
-
Use the following commands to create a new policy assignment for your resource group. This example uses an existing resource group that contains a virtual machine _without_ managed disks. The resource group is the scope for the policy assignment.
52
+
Use the following commands to create a new policy assignment for your resource group. This example uses an existing resource group that contains a virtual machine _without_ managed disks. The resource group is the scope for the policy assignment. This example uses the built-in policy definition [Audit VMs that do not use managed disks](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Compute/VMRequireManagedDisk_Audit.json).
51
53
52
54
Run the following commands and replace `<resourceGroupName>` with your resource group name:
0 commit comments