Azure / Azure/azure-cli-extensions
az monitor scheduled-query create doesn't support an identity parameter
- Dominant language
- Python
- Stars
- 454
- Forks
- 1.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 64
Description
## Describe the bug
Attempting to create a scheduled query using a Azure Resource Graph query results in an error because there is no way to specify an identity.
**Command Name**
`az monitor scheduled-query create
Extension Name: scheduled-query. Version: 1.0.0b1.`
**Errors:**
```
Code: BadRequest
Message: The 'adx' pattern cannot be used with the current authentication scheme. The request had some invalid properties Activity ID: d68240ec-44a7-4056-b84c-71793db58560.
```
## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
Provide a query that accesses Azure Resource Graph (arg)
```
az monitor scheduled-query create -n {} -g {} --scopes {} --action-groups {} --severity {} --evaluation-frequency {} --window-size {} --auto-mitigate {} --description {} \
--condition "count 'Placeholder_1' > 0 resource id vmResourceId" \
--condition-query Placeholder_1="arg('').patchassessmentresources | where properties.status =~ 'Succeeded' | extend securityOrCriticalUpdatesCount = iff(properties.osType =~ 'Windows', (toint(properties.availablePatchCountByClassification.security) + toint(properties.availablePatchCountByClassification.critical)), toint(properties.availablePatchCountByClassification.security)) | where securityOrCriticalUpdatesCount > 0 | extend vmResourceId = tostring(split(id, '/patchAssessmentResults/')[0]) | project vmResourceId" `
```
## Expected Behavior
Command needs an additional parameter to specify the identity, which looks like it was added in version `2022-08-01-preview` of the API.
https://learn.microsoft.com/en-us/azure/templates/microsoft.insights/change-log/scheduledqueryrules#2022-08-01-preview.
Other queries I've added via the cli command appear to be created using api version `2021-08-01`
## Environment Summary
```
Windows-11-10.0.22631-SP0
Python 3.12.7
Installer: MSI
azure-cli 2.67.0
Extensions:
datafactory 1.0.2
datamigration 1.0.0b2
maintenance 1.6.0
monitor-control-service 1.2.0
scheduled-query 1.0.0b1
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
```
## Additional Context
This is the option you get when creating via the portal:

Contributor guide
Assessment
This issue has not been assessed yet.