Share via

Azure Get API

Shreeshail Shailendra Gupte 6 Reputation points
2022-01-17T11:52:12.357+00:00

Hi,

We are trying to develop a python code which will return a json of all VMs for given Azure region along with its vCPU, Ram, pricing as per OS etc.

However after one hour it is getting expired. Here is the reference link for the API we are using.
https://learn.microsoft.com/en-us/rest/api/azureml/virtual-machine-sizes/list#code-try-0

How can we extend this one hour expiry to 1-3months?

Regards,
Shreeshail

Azure Machine Learning

1 answer

Sort by: Most helpful
  1. Rohit Mungi 49,131 Reputation points Microsoft Employee Moderator
    2022-01-18T06:24:11.84+00:00

    @Anonymous With the REST API call you will not be able to extend the expiry time for such a long period or time and it is not advisable to have the authentication open for longer periods with any of the methods to call the API.

    However, you can use the SDK with service principal authentication along with environment variables to have your authentication setup for longer periods and call the API using the SDK. Here is a sample notebook with all the authentication methods listed that you can try.

    Once this is setup you can call the supported_vmsizes method to get all the supported VMs for your workspace and region.

    If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

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