Azure管理REST API-“身份验证失败. “授权"标头以无效格式提供." [英] Azure Management REST API - "Authentication failed. The 'Authorization' header is provided in an invalid format."
问题描述
我正拼命尝试将2个经典存储帐户从我的旧MSDN订阅迁移到我的MPN订阅,并且一直遇到麻烦,因为仅通过REST API支持这些迁移.
I am desperately trying to move 2 classic storage accounts from my old MSDN subscription to my MPN subscription and I keep hitting a brick wall as move is only supported for these through REST APIs.
我已按照此处的说明启用了API....
I have enabled the APIs following the instructions here....
https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/
在这里...
https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx
但是我完全被弄糊涂了.根据建议,我创建了一个POST请求来检查状态,这是移动资源"说明中的第一个调用...
but am completely flummoxed. I have created a POST request as suggested to check status as the first call in the 'move resources' instructions...
POST https://management.azure.com/subscriptions/ {subscriptionId}/providers/Microsoft.ClassicCompute/validateSubscriptionMoveAvailability
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ClassicCompute/validateSubscriptionMoveAvailability
(将subscriptionId替换为每个ID),并在其中传递适当的源/目标主体.
(with the subscriptionId replaced with the ID for each) and passing the appropriate source / target body in.
我还提供了Authorization标头,如下所示...
I have also provided the Authorization header as follows...
授权:{Azure门户生成的密钥}
Authorization: {key as generated by the Azure portal}
现在完全迷路了.我尝试过同时使用Fiddler&邮差. PowerShell对我来说不是一个选择,因为我一点都不知道.我只想转移2个项目,到目前为止,仅运行这些管理API便使我损失了15英镑以上,而且我的网站即将失效,因为我的信用即将过期.
Completely lost now. I have tried using both Fiddler & Postman. PowerShell isn't an option for me because I don't know it at all. I just want to move 2 items over and so far just having these management APIs running has cost me over £15 and my website is on the verge of going down as my credit will soon expire.
任何帮助将不胜感激.
推荐答案
根据您的描述,您生成的方式似乎有问题:
Per your description, it seems that there is any thing wrong of the way you generate:
授权:{Azure门户生成的密钥}
Authorization: {key as generated by the Azure portal}
根据 https://msdn.microsoft上的文档描述.com/en-us/library/azure/dn790569.aspx#bk_common ,授权标头应该是您从Azure Active Directory(但直接从Azure Portal)获得的JSON Web令牌.
According the document description at https://msdn.microsoft.com/en-us/library/azure/dn790569.aspx#bk_common, the authorization header should be a JSON Web Token that you obtain from Azure Active Directory, but directly from Azure Portal.
您可以参考 https://azure.microsoft.com/zh-CN/documentation/articles/active-directory-protocols-oauth-code/,了解如何从AAD获取JWT.
You can refer to https://azure.microsoft.com/en-us/documentation/articles/active-directory-protocols-oauth-code/ for how to obtain a JWT from AAD.
并且Authorization标头应为:
Authorization : Bearer {JWT}
.
And the Authorization header should be in like:
Authorization : Bearer {JWT}
.
这篇关于Azure管理REST API-“身份验证失败. “授权"标头以无效格式提供."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!