Azure-docs: Property value is not allowed

Created on 11 Feb 2019  Â·  3Comments  Â·  Source: MicrosoftDocs/azure-docs

When trying to update a duplicate of allowed locations in the portal by adding "value" and an array of allowed locations as described in the documentation, I get:
image

Clicking Save removes the value array.


Dokumentoplysninger

⚠ Undlad at redigere denne sektion. Det er påkrævet til docs.microsoft.com ➟ GitHub-problemlinkning.

assigned-to-author azure-policsvc doc-bug in-progress triaged

All 3 comments

@Agazoth Looks like this is a typo. I'll get it fixed ASAP! It should be allowedValues. Also, I see this property isn't mentioned at all in the definition structure, so I'll address it there, as well. Thank you for catching this and pointing it out!

@MicrosoftDocs/azure-cxp-triage Please assign to me, label 'doc-bug', and #in-progress

@Agazoth Minor correction. I took a second look as I prepared to update this. The sample is correct. This is the JSON block you are seeing in the sample:

{
    "listOfAllowedLocations": {
        "value": ["eastus2", "westus"]
    }
}

This block is for passing to an existing policy definition during assignment and setting the value of the parameter for that assignment. In this use, the sample is correct.

The screenshot you showed above is trying to edit the policy definition itself and making a change to the parameter definition. That property is the one I mentioned, allowedValues. That is for use when you want to make the list of allowed values for a parameter during policy assignment restricted to an array of existing values. If you used allowedValues in your example above, any assignment of this policy definition could only use "eastus2" or "westus" for the parameter value.

Hope that clears things up! I'll still take an action to add allowedValues to the definition structure doc as it is missing. If you still think the doc is unclear or incorrect, let me know. Otherwise, when I update the definition doc this item will be closed automatically. Thank you again for reporting the issue!

AllowedValues works:
{
"mode": "indexed",
"policyRule": {
"if": {
"allOf": [
{
"field": "location",
"notIn": "[parameters('listOfAllowedLocations')]"
},
{
"field": "location",
"notEquals": "global"
},
{
"field": "type",
"notEquals": "Microsoft.AzureActiveDirectory/b2cDirectories"
}
]
},
"then": {
"effect": "deny"
}
},
"parameters": {
"listOfAllowedLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed locations",
"description": "The list of locations that can be specified when deploying resources.",
"strongType": "location"
},
"allowedValues": [
"westeurope",
"northeurope"
]
}
}
}

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

behnam89 picture behnam89  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

ianpowell2017 picture ianpowell2017  Â·  3Comments