Skip to content

Commit a99337b

Browse files
authored
Update create-policy-definition.md
Added support for system-assigned identity to download custom policy packages.
1 parent 66f2770 commit a99337b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ 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 downloading package from storage account container instead of using SaS url. When this option is enabled you cannot use the ManagedIdentityResourceId. Only one of the options should be used at a time. You can use this parameter without ExcludeArcMachines option as the system assigned identity is available for Arc machines.
127128

128129
> [!IMPORTANT]
129130
> Unlike Azure VMs, Arc-connected machines currently do not support User Assigned Managed
130131
> Identities. As a result, the `-ExcludeArcMachines` flag is required to ensure the exclusion of
131132
> those machines from the policy definition. For the Azure VM to download the assigned package and
132133
> apply the policy, the Guest Configuration Agent must be version `1.29.82.0` or higher for Windows
133134
> and version `1.26.76.0` or higher for Linux.
135+
> As an alternative System Assigned Managed Identities can be used to download packages for Arc-connected machines, and similar support has been provided for Azure options.
134136
135137
For more information about the **Mode** parameter, see the page
136138
[How to configure remediation options for machine configuration][02].
@@ -191,6 +193,26 @@ New-GuestConfigurationPolicy @PolicyConfig3 -ExcludeArcMachines
191193
For this scenario, you need to disable the **Allow Blob anonymous access** setting and assign the
192194
role **Storage Blob Data Reader** on the storage account to the identity.
193195

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

0 commit comments

Comments
 (0)