Skip to content

Commit 9643a9a

Browse files
freshness updates
1 parent f3fb9cd commit 9643a9a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

articles/virtual-machines/extensions/extensions-rmpolicy-howto-ps.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ ms.service: virtual-machines
66
ms.subservice: extensions
77
ms.author: gabsta
88
author: GabstaMSFT
9+
ms.reviewer: erd
910
ms.collection: windows
10-
ms.date: 03/23/2018
11+
ms.date: 03/20/2023
1112
ms.custom: devx-track-azurepowershell
1213

1314
---
@@ -24,7 +25,7 @@ This tutorial uses Azure PowerShell within the Cloud Shell, which is constantly
2425

2526
In order to restrict what extensions can be installed, you need to have a [rule](../../governance/policy/concepts/definition-structure.md#policy-rule) to provide the logic to identify the extension.
2627

27-
This example shows you how to deny extensions published by 'Microsoft.Compute' by creating a rules file in Azure Cloud Shell, but if you are working in PowerShell locally, you can also create a local file and replace the path ($home/clouddrive) with the path to the local file on your machine.
28+
This example shows you how to deny extensions published by 'Microsoft. Compute' by creating a rules file in Azure Cloud Shell, but if you're working in PowerShell locally, you can also create a local file and replace the path ($home/clouddrive) with the path to the local file on your machine.
2829

2930
In a [Cloud Shell](https://shell.azure.com/powershell), type:
3031

@@ -58,13 +59,13 @@ Copy and paste the following .json into the file.
5859
}
5960
```
6061

61-
When you are done, hit the **Ctrl + O** and then **Enter** to save the file. Hit **Ctrl + X** to close the file and exit.
62+
When you're done, hit the **Ctrl + O** and then **Enter** to save the file. Hit **Ctrl + X** to close the file and exit.
6263

6364
## Create a parameters file
6465

6566
You also need a [parameters](../../governance/policy/concepts/definition-structure.md#parameters) file that creates a structure for you to use for passing in a list of the extensions to block.
6667

67-
This example shows you how to create a parameters file for VMs in Cloud Shell, but if you are working in PowerShell locally, you can also create a local file and replace the path ($home/clouddrive) with the path to the local file on your machine.
68+
This example shows you how to create a parameters file for VMs in Cloud Shell, but if you're working in PowerShell locally, you can also create a local file and replace the path ($home/clouddrive) with the path to the local file on your machine.
6869

6970
In [Cloud Shell](https://shell.azure.com/powershell), type:
7071

@@ -86,13 +87,13 @@ Copy and paste the following .json into the file.
8687
}
8788
```
8889

89-
When you are done, hit the **Ctrl + O** and then **Enter** to save the file. Hit **Ctrl + X** to close the file and exit.
90+
When you're done, hit the **Ctrl + O** and then **Enter** to save the file. Hit **Ctrl + X** to close the file and exit.
9091

9192
## Create the policy
9293

9394
A policy definition is an object used to store the configuration that you would like to use. The policy definition uses the rules and parameters files to define the policy. Create a policy definition using the [New-AzPolicyDefinition](/powershell/module/az.resources/new-azpolicydefinition) cmdlet.
9495

95-
The policy rules and parameters are the files you created and stored as .json files in your cloud shell.
96+
The policy rules and parameter values below are the files you created and stored as .json files in your Cloud Shell. Replace the file paths as needed.
9697

9798

9899
```azurepowershell-interactive
@@ -109,7 +110,7 @@ $definition = New-AzPolicyDefinition `
109110

110111
## Assign the policy
111112

112-
This example assigns the policy to a resource group using [New-AzPolicyAssignment](/powershell/module/az.resources/new-azpolicyassignment). Any VM created in the **myResourceGroup** resource group will not be able to install the VM Access Agent or Custom Script extensions.
113+
This example assigns the policy to a resource group using [New-AzPolicyAssignment](/powershell/module/az.resources/new-azpolicyassignment). Any VM created in the **myResourceGroup** resource group won't be able to install the VM Access Agent or Custom Script extensions.
113114

114115
Use the [Get-AzSubscription | Format-Table](/powershell/module/az.accounts/get-azsubscription) cmdlet to get your subscription ID to use in place of the one in the example.
115116

@@ -132,7 +133,7 @@ $assignment
132133

133134
## Test the policy
134135

135-
To test the policy, try to use the VM Access extension. The following should fail with the message "Set-AzVMAccessExtension : Resource 'myVMAccess' was disallowed by policy."
136+
To test the policy, try to use the VM Access extension. The following should fail with the message "Set-AzVMAccessExtension: Resource 'myVMAccess' was disallowed by policy."
136137

137138
```azurepowershell-interactive
138139
Set-AzVMAccessExtension `

0 commit comments

Comments
 (0)