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 获取的 JSON Web 令牌,但直接从 Azure 门户获取.
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/en-us/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.
授权标头应该是这样的:授权:承载{JWT}
.
And the Authorization header should be in like:
Authorization : Bearer {JWT}
.
这篇关于Azure 管理 REST API -“身份验证失败.“授权"标头以无效格式提供."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!