[英]Partner Central rest api 401 unauthorized access
我遵循了Microsoft文檔,以獲取客戶的帳單資料。 通過帶有Powershell代碼的auth 教程
$credential = Get-Credential
Connect-PartnerCenter -Credential $credential -ServicePrincipal -TenantId '<TenantId>'
復制訪問令牌並產生一個Postman Get請求,但仍然收到401未經授權的請求
它可能來自Microsoft的安全更新,但是Auth文檔來自一月,所以我認為這些都是訪問Parner Central https://www.microsoftpartnercommunity.com/t5/UK-Partner-Zone-Discussions的步驟/ FY19-CSP-程序新的強制性安全,要求/ TD-p / 6981
否則,我作為用戶沒有正確的權限來獲取帳單資料。 我知道這是我監督的一步,或者是我做錯了但我看不到的一件事
我知道有關此問題的一些關於stackoverflow的問題。 但是似乎找不到解決方案
嘗試使用此Powershell代碼獲取訪問令牌:
$appId = 'xxxxxxxxxxxxxxxxxxxxx'
$appSecret = 'xxxxxxxxxxxxxxxx' | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $appId, $appSecret
$token = New-PartnerAccessToken -Consent -Credential $credential -Resource https://api.partnercenter.microsoft.com -ServicePrincipal
New-PartnerAccessToken -RefreshToken $token.RefreshToken -Resource https://api.partnercenter.microsoft.com -Credential $credential -ServicePrincipal
來源和更多對此的解釋,您可以在這里找到: docs如果鏈接無效,請搜索“合作伙伴中心”的“合作伙伴同意”流程
希望這對您有所幫助,這對我有用。 也很努力地找出這一點。
還要確保在您的Azure AD應用程序中,在“ Implicit grant
下面的“ Authentication
設置”中選擇訪問令牌。 然后在建議的重定向URL下方選擇urn:ietf:wg:oauth:2.0:oob
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.