使用Azure API列出所有区域 [英] List all the regions using the azure api

查看:50
本文介绍了使用Azure API列出所有区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用azure rest api获取可以在其中配置vm的所有可能区域.我发现的终点是

https://management.core.windows.net/<subscription-id>/位置

I am trying get all the possible regions to which a vm can be provisioned using the azure rest api. The end point which i found is

https://management.core.windows.net/<subscription-id>/locations

which is documented here

but i am getting an error.

<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>ForbiddenError</Code><Message>The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.</Message></Error>

Also i tried using the query param ?api-version=2016-04-01 and header x-ms-version: 2016-04-01 without any luck.

解决方案

According to your error code ForbiddenError, it seems that there is no authorization or incorrect authorization in the header. If it is that case, please have a try to add the authorization in the header. Authorization format is starting with "Bearer" like "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiI…..." . More info about how to get the access token please refer to the document. It works for me correctly, and I use the x-ms-version: 2014-10-01, details please refer to the snapshot.

这篇关于使用Azure API列出所有区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆