Script for "Create a policy parameter definition." is not working.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
Hi,
Under the examples given script for "Create a policy parameter definition." is not working.
Wrong part is: **parameters('listOfAllowedLocations')**
This is supposed to be: **parameters('allowedLocations')**
az policy definition create --name allowedLocations \
--rules "{ \"if\": { \"allOf\": [ \
{ \"field\": \"location\",\"notIn\": \"[parameters('listOfAllowedLocations')]\" }, \
{ \"field\": \"location\", \"notEquals\": \"global\" }, \
{ \"field\": \"type\", \"notEquals\": \
\"Microsoft.AzureActiveDirectory/b2cDirectories\"} \
] }, \"then\": { \"effect\": \"deny\" } }" \
--params "{ \"allowedLocations\": { \
\"type\": \"array\", \"metadata\": { \"description\": \
\"The list of locations that can be specified when deploying resources\", \
\"strongType\": \"location\", \"displayName\": \"Allowed locations\" } } }"
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: 436bf02d-dfe3-ef6e-2be8-1bd7b1f39623
* Version Independent ID: e8b92df3-9e3d-c4c7-1965-0b6b3f7d00ea
* Content: [az policy definition](https://learn.microsoft.com/en-us/cli/azure/policy/definition?view=azure-cli-latest)
* Content Source: [latest/docs-ref-autogen/policy/definition.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/policy/definition.yml)
* Service: **azure-resource-manager**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**
Contributor guide
Assessment
This issue has not been assessed yet.