Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell businessstore.microsoft.com oauth身份验证_Powershell_Oauth - Fatal编程技术网

Powershell businessstore.microsoft.com oauth身份验证

Powershell businessstore.microsoft.com oauth身份验证,powershell,oauth,Powershell,Oauth,我想创建一个Microsoft流(链接到PowerApps),甚至是一个连接到商业商店的PS脚本 我发现,当浏览businessstore.microsoft.com时,在“设备”下,会调用API以获取所需信息(在本例中是我的租户上的设备列表) 当我进行Fiddler跟踪时,我可以检索到一些有用的信息。如果我使用承载令牌,我可以直接对API进行一些调用,以获得我想要的。我的问题是获得正确的持票人代币。。。我暂时没有办法 所以我希望有人能帮我找到一种认证的方法,不用使用网络浏览器和fiddler就

我想创建一个Microsoft流(链接到PowerApps),甚至是一个连接到商业商店的PS脚本

我发现,当浏览businessstore.microsoft.com时,在“设备”下,会调用API以获取所需信息(在本例中是我的租户上的设备列表)

当我进行Fiddler跟踪时,我可以检索到一些有用的信息。如果我使用承载令牌,我可以直接对API进行一些调用,以获得我想要的。我的问题是获得正确的持票人代币。。。我暂时没有办法

所以我希望有人能帮我找到一种认证的方法,不用使用网络浏览器和fiddler就可以得到这个承载令牌。。。通过使用ADAL作为示例或其他方式

以下是我掌握的信息:

$MicrosoftStoreURL = "https://businessstore.microsoft.com/en-us/manage/devices/all"

$clientid = "45a330b1-b1ec-4cc1-9161-9f03992aa49f"
$redirectURI = "https://businessstore.microsoft.com/auth/"
$APIHost = "businessstoremgmtapiprod.azure-api.net"
$DevicesURI = "https://businessstoremgmtapiprod.azure-api.net/BD-PROD/devicemgmt/devices?api-version=1.0"
这样,我就可以连接到商业商店,使用Fiddler(和x-APIM-key,但始终相同)获取承载令牌,并获取设备:

$uri = "https://businessstoremgmtapiprod.azure-api.net/bd-prod/devicemgmt/devices?api-version=1.0"
$headers = @{
"Authorization" = ("Bearer <TOKEN_ID>")
"x-APIM-Key" = "08149b32571f450ca031f315a1d3e64e"
}
(Invoke-RestMethod -Uri $uri -Headers $headers -Method Get).Results
$uri=”https://businessstoremgmtapiprod.azure-api.net/bd-prod/devicemgmt/devices?api-版本=1.0“
$headers=@{
“授权”=(“持票人”)
“x-APIM-Key”=“08149B32571F450CA031F1315A1D3E64E”
}
(调用RestMethod-Uri$Uri-Headers$Headers-Method Get)
我还尝试使用我自己的本机应用程序进行访问,该应用程序已在我的租户上注册,但我找不到正确的权限

同样,如何通过在PowerApps连接器中使用Oauth2身份验证或使用PowerShell和ADAL来获取此令牌