azure-sdk-for-js
azure-sdk-for-js copied to clipboard
Calling Metrics list at subscription scope gives an ApiVersion: 2018-01-01 error
- Package Name: azure/arm-monitor
- Package Version: 7.0.0
- Operating system: Windows
- [ ] nodejs
- version: 21.7.1
- [ ] browser
- name/version:
- [ ] typescript
- version: 5.4.3
- Is the bug related to documentation in
- [ ] README.md
- [ ] source code documentation
- [ ] SDK API docs on https://docs.microsoft.com
Describe the bug We have a typescript code that makes a call to get metrics from multiple resources using Azure monitor REST API call. The API we are using is https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/providers/microsoft.Insights/metrics?timespan=2023-06-25T22:20:00.000Z/2023-06-26T22:25:00.000Z&interval=PT5M&metricnames=Percentage CPU&aggregation=average&api-version=2021-05-01®ion=eastus&metricNamespace=microsoft.compute/virtualmachines&$filter=Microsoft.ResourceId eq '*'
However when we make a call to this API from our code, we get an error " ApiVersion: 2018-01-01 does not support query at non Arm resource Id level"
To Reproduce Steps to reproduce the behavior:
- Attached the code that we use to run.
- I think the error is happening on the line which is calling the monitorclient API azure-api.txt
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzmonActionG @AzmonAlerts @AzMonEssential @AzmonLogA @dadunl @SameergMS.
@srini1978 Currently we only allow to set apiVersion for client operations share the same version, but for monitor its operations would have multiple apiVersions and this is not supported. We will review this on how to support it internally.
As a workaround you could follow the guide to add a policy to customize your apiVersion.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzmonActionG @AzmonAlerts @AzMonEssential @AzmonLogA @dadunl @SameergMS.
@jamlai The apiVersion for metrics operations in JS SDK(code here) is still 2018-01-01 but the latest version is already 2023-01-01(spec here), this would cause customers failed to call list operation.
Could we have a release request to upgrade them?
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough?tabs=portal#retrieve-metric-values
@MaryGao Any update on this ?
@srini1978 I am preparing the release and feel free to take a look! https://github.com/Azure/azure-sdk-for-js/pull/29089
create a release request https://github.com/Azure/sdk-release-request/issues/5097 to track sdk progress
released: https://www.npmjs.com/package/@azure/arm-monitor/v/8.0.0-beta.5.