Azure Resource Graph API – 通过数据工厂获取资源表

huangapple go评论52阅读模式
英文:

Azure Resource Graph API - Get Resources table via Data Factory

问题

I'm creating a Data Factory pipeline with Web Activity, and that activity is using Azure Resource Graph API to query the resources table. And after I'll use copy data activity to copy the data to a blob container. I already created it but the output file returns the same Web Activity results.

For example, and using the Web Activity, it is working well, but only returns 201 rows and if I execute the kusto query in Azure Graph Explorer returns 286 rows.

And if I filter by type = "microsoft.desktopvirtualization/hostpools" it will return 0 rows via API, but in Azure Graph Explorer returns 2 rows. I think it will only query the first 200 lines and not the whole set because I tried with order by asc or desc and with "| take 500" (for example) and it didn't work either.

I checked the Microsoft documentation and it says that the limit is 1000 rows, so I don't understand why it doesn't return more rows.

Results with type filter:

Azure Graph Explorer:

ADF Output:

ADF Pipeline:

URL: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01

Method: POST

Body:

{
"query": "resources"
}

Resource: https://management.azure.com

Headers: Content-Type; application/json

英文:

I'm creating a Data Factory pipeline with Web Activity, and that activity is using Azure Resource Graph API to query the resources table. And after I'll use copy data activity to copy the data to blob container. I already created it but the output file returns the same Web Activity results.

For example, and using the Web Activity,it is working well, but only returns 201 rows and if I execute the kusto query in Azure Graph Explorer returns 286 rows.

And if I filter by type = "microsoft.desktopvirtualization/hostpools" it will return 0 rows via API, but in Azure Graph Explorer returns 2 rows I think it will only queries the first 200 lines and not the whole set, because I tried with order by asc or desc and with "| take 500" (for example) and it didn't work either.

I checked the microsoft documentation and it says that the limit is 1000 rows, so I don't understand why it doesn't return more rows:

Azure Resource Graph API – 通过数据工厂获取资源表

Results with type filter:

Azure Graph Explorer:

Azure Resource Graph API – 通过数据工厂获取资源表

ADF Output:

Azure Resource Graph API – 通过数据工厂获取资源表

ADF Pipeline:

URL: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01

Method: POST

Body:

{
  "query": "resources"
}

Resource: https://management.azure.com

Headers: Content-Type; application/json
Azure Resource Graph API – 通过数据工厂获取资源表

Does anyone have similar issue/experience?

Thanks a lot!

答案1

得分: 1

你需要检查Azure数据工厂的访问权限。它需要在您期望在API调用中返回的所有Azure资源上具有读取者角色:

Azure Resource Graph API – 通过数据工厂获取资源表

您可以在资源、资源组、订阅或管理组级别分配角色。

干杯!

英文:

I would check the access your Azure Data Factory has. It needs to have Reader Role on all of the Azure resources you are expecting to return in the API Call:

Azure Resource Graph API – 通过数据工厂获取资源表

You can assign a role at a Resource, Resource Group, Subscription, or Management Group Level.

Cheers!

huangapple
  • 本文由 发表于 2023年5月10日 22:49:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76219845.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定