我想通過curl使用Azure AD向Azure Service Management API進行身份驗證。使用Azure Active Directory進行Azure服務管理API身份驗證Oauth
我set up an application在我的默認目錄。在這個免費試用中,這是我唯一的目錄。
當我定位oauth令牌端點時,我收到一個JWT。
curl --data "grant_type=client_credentials&client_id=<my_client_id>&client_secret=<my_encoded_secret>&resource=https%3A%2F%2Fmanagement.core.windows.net" https://login.windows.net/<my_tenant_id>/oauth2/token
但是當我使用該令牌列出我的訂閱細節我收到一個錯誤:
curl -H "x-ms-version: 2014-06-01" \
-H "Authorization: Bearer <my_token>" \
https://management.core.windows.net/<my_subscription_id>/
<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>
我已授予權限的服務管理API的應用程序作爲「委派權限」,因爲「應用程序權限「不可用。
我在想什麼?
Matt,這有什麼好運氣?我正面臨類似的問題。 – batta 2014-09-27 02:05:09