Onki
Onki

Reputation: 2095

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

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"

the error which I get is below :

{ "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 } }

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

Upvotes: 0

Views: 1950

Answers (1)

Sridevi
Sridevi

Reputation: 22352

I tried to reproduce the same in my environment and got the below results

I ran the same commands as you and got the same error as below:

token=$(az account get-access-token --subscription subscriptionID --resource-type arm --query accessToken --output tsv)
url="https://management.azure.com/subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.MachineLearningServices/workspaces/workspace_name/onlineEndpoints/endpoint_name/token?api-version=2022-05-01"
curl -d POST --header "Authorization: Bearer $token" $url 

Response:

enter image description here

When I did the same via Postman, I got the AML token successfully like below:

enter image description here

Alternatively, make use of below Azure CLI command to get AML token like below:

az ml online-endpoint get-credentials --name <endpoint_name> --resource-group <rg_name> --workspace-name <workspace_name>

I ran the same command and got AML token successfully like below:

enter image description here

When I decoded the token in jwt.ms, I got the claims same as token from Postman like below:

enter image description here

Upvotes: 0

Related Questions