SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top