az policy set-definition create --params doesn't upload strongType and assignPermissions value from parameter metadata
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### **This is autogenerated. Please review and update as needed.**
## Describe the bug
**Command Name**
`az policy set-definition create`
**Errors:**
No CLI Error as such. The command executes successfully. But azure portal doesn't show the all the parameter metadata attributes.
## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Create a policy defintion which accepts a "logAnalytics" parameter which is a path of log analytics workspace
- Create an initiave with above policy definition and a "logAnalytics" parameter which is a path of log analytics workspace
- During assignment of initiative, as we want the log analytics to be shown as a drop down, we specify the strongType metadata as for this parameter in both policy and in initiative as below
` "parameters": {
"logAnalytics": {
"type": "String",
"metadata": {
"displayName": "Log Analytics workspace",
"description": "Select Log Analytics workspace from dropdown list. If this workspace is outside of the scope of the assignment you must manually grant 'Log Analytics Contributor' permissions (or similar) to the policy assignment's principal ID.",
"strongType": "omsWorkspace",
"assignPermissions": true
}
}
},`
- Then we deploy the policy definition using `az policy` command on a subscription and try to assign it in Azure Portal. But it won't show the drop down in parameters.
- Then we deploy the initiative using below command on a subscription and try to assign it in Azure Portal. But it won't show the drop down in parameters.
- `az policy set-definition create --name "deploy-diagsetting-loganalytics" --description "Deploys diagnostic settings policy for all supported resources" --display-name "deploy-diagsetting-loganalytics" --metadata category=Monitoring version=1.0.0 --params "{"logAnalytics":{"type":"String","metadata":{"displayName":"Log Analytics workspace","description":"Select Log Analytics workspace from dropdown list. If this workspace is outside of the scope of the assignment you must manually grant 'Log Analytics Contributor' permissions (or similar) to the policy assignment's principal ID.","strongType":"Microsoft.OperationalInsights/workspaces","assignPermissions":true}}}" --definitions "[{"policyDefinitionId":"/subscriptions//providers/Microsoft.Authorization/policyDefinitions/deploy-afd-diagsetting","parameters":{"logAnalytics":{"value":"[parameters('logAnalytics')]"}},"groupNames":[]}]" --subscription ""`
## Expected Behavior
- Both Policy and Policy intiative should show log analytics drop down in its parameter when the strongType is specified either "omsWorkspace" or "Microsoft.OperationalInsights/workspaces"
## Environment Summary
```
macOS-11.2.2-x86_64-i386-64bit
Python 3.8.8
Installer: HOMEBREW
azure-cli 2.19.1 *
```
This also happens when azure pipeline executes the above steps on a VM with vmImage: 'ubuntu-18.04'
## Additional Context
- After deploying when we export the policy/intiative definition back, it doesn't contain the below attributes from the parameter metadata: strongType, assignPermissions
Contributor guide
Assessment
This issue has not been assessed yet.