getting error -> does not support the API version '2022-05-01' while making query for arm using CURL

JA 131 Reputation points
2022-10-14T11:36:42.973+00:00

I am trying to get the AML token using CLI.
I am able to get the token using the command -> token=$(az account get-access-token --subscription {subscri ID} --resource-type arm --query accessToken --output tsv)

but when I use this token to get the AMLToken I get below error, however it is working fine if I make this query using postman :
curl -d POST --header "Authorization: Bearer $token" "https://management.azure.com/subscriptions/{subcri id}/resourceGroups/{res_grup}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/onlineEndpoints/{endpoint}/token?api-version=2022-05-01"

any helps or pointers please, why I am getting this error? Not able to find any documentation for it.

Error which I am getting is this->

{
"error": {
"code": "UnsupportedApiVersion",
"message": "The HTTP resource that matches the request URI 'https://cert-eastus2.experiments.azureml.net/mferp/managementfrontend/subscriptions/{sub_id}/resourceGroups/{r_group}/providers/Microsoft.MachineLearningServices/workspaces/{workspace}/onlineEndpoints/{endpoint}/token' does not support the API version '2022-05-01'.",
"innerError": null
}
}

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,888 questions
Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
807 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 51,611 Reputation points
    2022-10-15T08:55:59.363+00:00

    Hello @JA

    Thanks for reaching out to us. I have seen a similar issue posted here, the reason for the issue is caused by using pip to install Azure CLI. Please check on below solution for this issue and let me know if that works for you or not. - https://github.com/Azure/azure-cli/issues/23821

    The reason for this issue is https://aka.ms/InstallAzureCLIDeb installs Azure CLI DEB package at /opt/az, but your Azure CLI was installed with pip judging by the installation location: /usr/local/lib/python3.8/site-packages/azure/cli

    We recommend installing the Azure CLI DEB package, but if you have to use pip, we recommend installing to a virtual environment. See #20476 (comment) - https://github.com/Azure/azure-cli/issues/20476#issuecomment-1007131837.

    Please be aware that installing from pip is not officially supported.

    I hope this helps.

    Regards,
    Yutong

    -Please kindly accept the answer if you feel helpful to support the conmunity, thanks a lot.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.