Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. $az = Connect-AzAccount
  2.  
  3. # Save the subscription/tentant ID for later
  4. $subscriptionID = $az.Context.Subscription.Id
  5. $tenantID = $az.Context.Subscription.TenantId
  6. $roleDef = Get-AzRoleDefinition -Name "DNS Zone Contributor"
  7. $roleDef.Id = $null
  8. $roleDef.Name = "DNS TXT Contributor"
  9. $roleDef.Description = "Manage DNS TXT records only."
  10. $roleDef.Actions.RemoveRange(0,$roleDef.Actions.Count)
  11. $roleDef.Actions.Add("Microsoft.Network/dnsZones/TXT/*")
  12. $roleDef.Actions.Add("Microsoft.Network/dnsZones/read")
  13. $roleDef.Actions.Add("Microsoft.Authorization/*/read")
  14. $roleDef.Actions.Add("Microsoft.Insights/alertRules/*")
  15. $roleDef.Actions.Add("Microsoft.ResourceHealth/availabilityStatuses/read")
  16. $roleDef.Actions.Add("Microsoft.Resources/deployments/read")
  17. $roleDef.Actions.Add("Microsoft.Resources/subscriptions/resourceGroups/read")
  18. $roleDef.AssignableScopes.Clear()
  19. $roleDef.AssignableScopes.Add("/subscriptions/$($az.Context.Subscription.Id)")
  20.  
  21. $role = New-AzRoleDefinition $roleDef
  22. $role
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement