Hi @Hamid ,
When doing CLI --rule the json should only encompass the policy rule. Example can be found here: https://learn.microsoft.com/en-us/cli/azure/policy/definition?view=azure-cli-latest#az-policy-definition-create
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am looking for some assistance with deploying a custom Azure Policy.
I have authored a policy and am able to deploy via the portal, but when I attempt to deploy via CLI I am getting the following error:
Failed to parse policy rule: 'Could not find member 'properties' on object of type 'PolicyRuleDefinition'. Path 'properties'.'.
The command used is below:
az policy definition create --name "deploy-networkwatcher-extension-windows" --display-name "Deploy Network Watcher Extension Agent" --description "This policy deploys the Azure Network Watcher Extension on Windows VMs." --rules "policy.json" --mode all
Looking at the examples/samples I did not that authors were using a rules.json that did not include properties. I tried creating one myself but this didnt work either, so I am stuck in understanding my error.
I have attached a copy of my policy and rules json files. I would appreciate if someone could review and advise on my mistake.
Hi @Hamid ,
When doing CLI --rule the json should only encompass the policy rule. Example can be found here: https://learn.microsoft.com/en-us/cli/azure/policy/definition?view=azure-cli-latest#az-policy-definition-create