Skip to content

Commit d2a1faf

Browse files
committed
Azure Poolicy custom role for DINE, GC How-To
1 parent cfef331 commit d2a1faf

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

articles/governance/policy/how-to/guest-configuration-create-linux.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ Finally, publish the policy definitions using the `Publish-GuestConfigurationPol
307307
The cmdlet only has the **Path** parameter that points to the location of the JSON files
308308
created by `New-GuestConfigurationPolicy`.
309309

310+
Publishing a new policy definition will require **Resource Policy Contributor** access in Azure.
311+
310312
```azurepowershell-interactive
311313
Publish-GuestConfigurationPolicy `
312314
-Path '.\policyDefinitions'
@@ -334,6 +336,23 @@ and [Azure PowerShell](../assign-policy-powershell.md).
334336
> assigned, the prerequisites aren't deployed and the policy always shows that '0' servers are
335337
> compliant.
336338
339+
Assigning an Azure Policy with _DeployIfNotExists_ type requires an additional level of access.
340+
To grant the least privilege, you can create a custom role definition
341+
that extends **Resource Policy Contributor**. The example below creates a role named
342+
**Resource Policy Contributor DINE** with the additional permission *Microsoft.Authoirzation/roleAssignments/write*.
343+
344+
```azurepowershell-interactive
345+
$subscriptionid = '00000000-0000-0000-0000-000000000000'
346+
$role = Get-AzRoleDefinition "Resource Policy Contributor"
347+
$role.Id = $null
348+
$role.Name = "Resource Policy Contributor DINE"
349+
$role.Description = "Can assign Policies that require remediation."
350+
$role.Actions.Clear()
351+
$role.Actions.Add("Microsoft.Authorization/roleAssignments/write")
352+
$role.AssignableScopes.Clear()
353+
$role.AssignableScopes.Add("/subscriptions/$subscriptionid")
354+
New-AzRoleDefinition -Role $role
355+
```
337356

338357
### Using parameters in custom Guest Configuration policies
339358

articles/governance/policy/how-to/guest-configuration-create.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ Finally, publish the policy definitions using the `Publish-GuestConfigurationPol
354354
cmdlet only has the **Path** parameter that points to the location of the JSON files created by
355355
`New-GuestConfigurationPolicy`.
356356

357+
Publishing a new policy definition will require **Resource Policy Contributor** access in Azure.
358+
357359
```azurepowershell-interactive
358360
Publish-GuestConfigurationPolicy `
359361
-Path '.\policyDefinitions'
@@ -381,6 +383,23 @@ initiative with [Portal](../assign-policy-portal.md), [Azure CLI](../assign-poli
381383
> assigned, the prerequisites aren't deployed and the policy always shows that '0' servers are
382384
> compliant.
383385
386+
Assigning an Azure Policy with _DeployIfNotExists_ type requires an additional level of access.
387+
To grant the least privilege, you can create a custom role definition
388+
that extends **Resource Policy Contributor**. The example below creates a role named
389+
**Resource Policy Contributor DINE** with the additional permission *Microsoft.Authoirzation/roleAssignments/write*.
390+
391+
```azurepowershell-interactive
392+
$subscriptionid = '00000000-0000-0000-0000-000000000000'
393+
$role = Get-AzRoleDefinition "Resource Policy Contributor"
394+
$role.Id = $null
395+
$role.Name = "Resource Policy Contributor DINE"
396+
$role.Description = "Can assign Policies that require remediation."
397+
$role.Actions.Clear()
398+
$role.Actions.Add("Microsoft.Authorization/roleAssignments/write")
399+
$role.AssignableScopes.Clear()
400+
$role.AssignableScopes.Add("/subscriptions/$subscriptionid")
401+
New-AzRoleDefinition -Role $role
402+
```
384403

385404
### Using parameters in custom Guest Configuration policies
386405

0 commit comments

Comments
 (0)