Azure / Azure/azure-cli-extensions

az monitor scheduled-query create doesn't support an identity parameter

Open
#8,364 1 comment 0 reactions 1 assignee Claimed by @AllyW View on GitHub
Auto-Assign Azure CLI Team customer-reported Monitor question
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:
![Image](https://github.com/user-attachments/assets/27eb2225-3283-4dc8-b0b5-d337afb8e79e)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.