有没有办法将分配给api和操作级别的有效策略导出到xml文件?

问题描述 投票:0回答:1

我尝试了下面的选项,但它没有获取分配给 api 或操作的有效策略,因为它只获取单独分配给它们的策略

curl --location 'https://management.azure.com/subscriptions/xxxxxxxxxxxx/resourceGroups/xxxxxxxxx/providers/Microsoft.ApiManagement/service/xxxxxxxxxx/apis/apiname/policies/policy?format=xml&api-version=2022-08-01' --header 'Content-Type: application/json' --header 'Authorization: Bearer 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
azure api azure-api-management azure-api-apps
1个回答
0
投票

您可以通过以下网址查看API级别的有效政策。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/policy?effective=true&format=xml&api-version=2022-08-01

CURL 请求-

curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0e************" "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/policy?effective=true&format=xml&api-version=2022-08-01"

我收到的回复如下-

enter image description here

要获取操作级别的有效政策,您可以使用以下网址。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/policy?effective=true&format=xml&api-version=2022-08-01

CURL 请求-

curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eX******" "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/{apiId}/operations/{operationId}/policies/policy?effective=true&format=xml&api-version=2022-08-01"

回应-

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.