我的Azure ML api rest返回一个空对象



我的问题

我尝试使用REST API进行机器学习。以下PowerShell没有失败,但返回了一个空的objet,无论我测试的是什么API。我的SPN拥有贡献者权限,我同意授予,并检查我是否获得了令牌。

我使用的文档:

https://learn.microsoft.com/fr-fr/rest/api/azureml/quotas/list

我还测试了其他几个GET API。

我不知道该怎么做。知道吗?

我的Powershell代码

$tenant_id = "XXXXXXXXXXXXXXXXXXX"
$ApplicationId = "XXXXXXXXXXXXXXX"
$spn_client_secret = "XXXXXXXXXXXXX"
$subscriptionid="XXXXXXXXXXXX"
$uri = "https://login.microsoftonline.com/$tenant_id/oauth2/token"
$BodyText = "grant_type=client_credentials&client_id=$ApplicationId&resource=https://management.azure.com&client_secret=$spn_client_secret"
# GET TOKEN
$Response = Invoke-RestMethod -Method POST -Body $BodyText -Uri $URI -ContentType application/x-www-form-urlencoded        
$aad_access_token = $Response.access_token
# tested, I effectively have a token
# READ ml
$urllist = "https://management.azure.com/subscriptions/$subscriptionid/providers/Microsoft.MachineLearningServices/locations/westeurope/quotas?api-version=2021-03-01-preview"
$headers = @{"Authorization" = "Bearer " + $aad_access_token}
Invoke-RestMethod -Method GET -HEADERS $headers -Uri $urllist -ContentType application/x-www-form-urlencoded  

我发现了发生的事情,我有点困惑。

资源是空的,因为我完全忘记了创建一个计算!

最新更新