-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not possible to update policyDefinitionReferenceId with New- or Update-AzPolicySetDefinition #25112
Comments
Thank-you for reporting this problem. I have repro'd the issue, and we are pursuing a fix. In the meantime, you can work around it by using the property name "id" instead of "policyDefinitionReferenceId" in your input file like this:
This will correctly serialize to "policyDefinitionReferenceId" in the backend:
Sorry for the inconvenience this has caused: we will address it on our end as soon as possible. |
- Root cause is wrong naming of a serialization property - This fix is a workaround for the incorrect name - Needs to be updated once the root cause is corrected
* Interim fix for #25112. - Root cause is wrong naming of a serialization property - This fix is a workaround for the incorrect name - Needs to be updated once the root cause is corrected * Add thorough test coverage for PolicyDefinitionReference type * Fix serialization problem on Windows Powershell * Re-record playback files
Tested and is fixed in 7.4.0 of Az.Resources. |
Description
I want to update my policyDefinitionReferenceIds in my policy initiative definition definitions.json.
I am using a policy initiative definition file:
networkdef.json
and a parameter file:
networkparam.json
These 2 files are how I created the policy initiative definition. However, the policyDefinitionReferenceIds is being overwritten by the system and automatically generated. You can see that result in the first file (definitions.json)
To create the definition, I use this command:
The above code, should have created the policyDefinitionReferenceIds for me. However, it is ignored as I said.
When I then try to update them again, I get the same result regardless if I use
Update-AzPolicySetDefinition
orNew-AzPolicySetDefinition
.New-AzPolicySetDefinition -Name 'Enforce-Guardrails-Network' -PolicyDefinition .\definitions.json -Parameter .\networkparam.json
or
Update-AzPolicySetDefinition -Name 'Enforce-Guardrails-Network' -PolicyDefinition .\definitions.json -Parameter .\networkparam.json
Output:
Expected Output
When running the $DebugPreference it is clear that the property policyDefinitionReferenceId is not part of the properties available
Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: