Skip to content

Commit 2343df8

Browse files
Merge pull request #300572 from ameyaiam3/patch-5
Update create-policy-definition.md
2 parents 98b543c + ebefe43 commit 2343df8

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

articles/governance/machine-configuration/how-to/create-policy-definition.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,24 @@ Parameters of the `New-GuestConfigurationPolicy` cmdlet:
124124
- **ExcludeArcMachines**: Specifies that the Policy definition should exclude Arc machines. This
125125
parameter is required if you are using a User Assigned Managed Identity to provide access to an
126126
Azure Storage blob.
127+
- **UseSystemAssignedIdentity**: This is the option to use the system assigned identity for
128+
downloading package from storage account container instead of using SaS URL.
129+
130+
You can't use this option with the **ManagedIdentityResourceId**. The options are mutually
131+
exclusive.
132+
133+
You can use this parameter without **ExcludeArcMachines** option as the system assigned
134+
identity is available for Arc machines.
127135

128136
> [!IMPORTANT]
129137
> Unlike Azure VMs, Arc-connected machines currently do not support User Assigned Managed
130138
> Identities. As a result, the `-ExcludeArcMachines` flag is required to ensure the exclusion of
131139
> those machines from the policy definition. For the Azure VM to download the assigned package and
132140
> apply the policy, the Guest Configuration Agent must be version `1.29.82.0` or higher for Windows
133141
> and version `1.26.76.0` or higher for Linux.
142+
>
143+
> For Arc-connected machines, you can also use System Assigned Managed Identities to download
144+
> packages.
134145
135146
For more information about the **Mode** parameter, see the page
136147
[How to configure remediation options for machine configuration][02].
@@ -191,6 +202,27 @@ New-GuestConfigurationPolicy @PolicyConfig3 -ExcludeArcMachines
191202
For this scenario, you need to disable the **Allow Blob anonymous access** setting and assign the
192203
role **Storage Blob Data Reader** on the storage account to the identity.
193204

205+
Create a policy definition that _enforces_ a custom configuration package using a System-Assigned
206+
Managed Identity:
207+
208+
```powershell
209+
$PolicyConfig4 = @{
210+
PolicyId = '_My GUID_'
211+
ContentUri = $contentUri
212+
DisplayName = 'My deployment policy'
213+
Description = 'My deployment policy'
214+
Path = './policies/deployIfNotExists.json'
215+
Platform = 'Windows'
216+
PolicyVersion = 1.0.0
217+
Mode = 'ApplyAndAutoCorrect'
218+
LocalContentPath = "C:\Local\Path\To\Package" # Required parameter for managed identity
219+
}
220+
New-GuestConfigurationPolicy @PolicyConfig4 -UseSystemAssignedIdentity
221+
```
222+
223+
For this scenario, you need to disable the **Allow Blob anonymous access** setting and assign the
224+
role **Storage Blob Data Reader** on the storage account to the system identity.
225+
194226
> [!NOTE]
195227
> You can retrieve the resourceId of a managed identity using the `Get-AzUserAssignedIdentity`
196228
> PowerShell cmdlet.

0 commit comments

Comments
 (0)