I would like to know if it is possible to use the default pre-defined ARM policies for assignments through the CLI.
Essentially, I have noticed that there is a default policy to restrict the location within the portal, so if you use the portal you can can select this and then it allows you to select some regions.
If I create a location policy from the cli, I seem to have to create a brand new custom policy definition, which shows up alongside the default one in the definitions page.
Is there a way to simly use the default one, but specify which regions??
Here is the custom definition:
az policy definition create --name permittedRegions --description "location policy" --rules '{
"if" : {
"not" : {
"field" : "location",
"in" : ["westus", "westus2", "centralus", "westcentralus"]
}
},
"then" : {
"effect" : "deny"
}
}'
az policy assignment create --name permittedRegionsInSubscription --policy permittedRegions --scope /subscriptions/"$subscriptionId"