다음을 통해 공유


Policy - Get

Api Management 서비스의 전역 정책 정의를 가져옵니다.

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

URI 매개 변수

Name In(다음 안에) 필수 형식 Description
policyId
path True

PolicyIdName

정책의 식별자입니다.

resourceGroupName
path True

string

리소스 그룹의 이름입니다.

serviceName
path True

string

minLength: 1
maxLength: 50
pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

API Management 서비스의 이름입니다.

subscriptionId
path True

string

Microsoft Azure 구독을 고유하게 식별하는 구독 자격 증명입니다. 구독 ID는 모든 서비스 호출에 대한 URI의 일부를 형성합니다.

api-version
query True

string

클라이언트 요청과 함께 사용할 API의 버전입니다.

format
query

PolicyExportFormat

정책 내보내기 형식입니다.

응답

Name 형식 Description
200 OK

PolicyContract

Api Management 서비스의 전역 정책 정의를 가져옵니다.

헤더

ETag: string

Other Status Codes

ErrorResponse

작업이 실패한 이유를 설명하는 오류 응답입니다.

보안

azure_auth

Azure Active Directory OAuth2 Flow.

형식: oauth2
Flow: implicit
권한 부여 URL: https://login.microsoftonline.com/common/oauth2/authorize

범위

Name Description
user_impersonation 사용자 계정 가장

예제

ApiManagementGetPolicy
ApiManagementGetPolicyFormat

ApiManagementGetPolicy

샘플 요청

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy?api-version=2021-08-01

샘플 응답

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy",
  "type": "Microsoft.ApiManagement/service/policies",
  "name": "policy",
  "properties": {
    "value": "<!--\r\n    IMPORTANT:\r\n    - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\r\n    - Only the <forward-request> policy element can appear within the <backend> section element.\r\n    - To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element.\r\n    - To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element.\r\n    - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\r\n    - To remove a policy, delete the corresponding policy statement from the policy document.\r\n    - Policies are applied in the order of their appearance, from the top down.\r\n-->\r\n<policies>\r\n  <inbound />\r\n  <backend>\r\n    <forward-request />\r\n  </backend>\r\n  <outbound />\r\n</policies>"
  }
}

ApiManagementGetPolicyFormat

샘플 요청

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy?format=rawxml&api-version=2021-08-01

샘플 응답

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy",
  "type": "Microsoft.ApiManagement/service/policies",
  "name": "policy",
  "properties": {
    "format": "rawxml",
    "value": "<!--\n    IMPORTANT:\n    - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\n    - Only the <forward-request> policy element can appear within the <backend> section element.\n    - To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element.\n    - To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element.\n    - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\n    - To remove a policy, delete the corresponding policy statement from the policy document.\n    - Policies are applied in the order of their appearance, from the top down.\n-->\r\n<policies>\r\n\t<inbound>\r\n\t\t<set-header name=\"correlationid\" exists-action=\"skip\">\r\n\t\t\t<value>@{\n                var guidBinary = new byte[16];\n                Array.Copy(Guid.NewGuid().ToByteArray(), 0, guidBinary, 0, 10);\n                long time = DateTime.Now.Ticks;\n                byte[] bytes = new byte[6];\n                unchecked\n                {\n                       bytes[5] = (byte)(time >> 40);\n                       bytes[4] = (byte)(time >> 32);\n                       bytes[3] = (byte)(time >> 24);\n                       bytes[2] = (byte)(time >> 16);\n                       bytes[1] = (byte)(time >> 8);\n                       bytes[0] = (byte)(time);\n                }\n                Array.Copy(bytes, 0, guidBinary, 10, 6);\n                return new Guid(guidBinary).ToString();\n            }\n            </value>\r\n\t\t</set-header>\r\n\t</inbound>\r\n\t<backend>\r\n\t\t<forward-request />\r\n\t</backend>\r\n\t<outbound />\r\n\t<on-error />\r\n</policies>"
  }
}

정의

Name Description
ErrorFieldContract

오류 필드 계약입니다.

ErrorResponse

오류 응답입니다.

PolicyContentFormat

policyContent의 형식입니다.

PolicyContract

정책 계약 세부 정보입니다.

PolicyExportFormat

정책 내보내기 형식입니다.

PolicyIdName

정책의 식별자입니다.

ErrorFieldContract

오류 필드 계약입니다.

Name 형식 Description
code

string

속성 수준 오류 코드입니다.

message

string

사람이 읽을 수 있는 속성 수준 오류 표현입니다.

target

string

속성 이름입니다.

ErrorResponse

오류 응답입니다.

Name 형식 Description
error.code

string

서비스 정의 오류 코드입니다. 이 코드는 응답에 지정된 HTTP 오류 코드의 하위 상태로 사용됩니다.

error.details

ErrorFieldContract[]

유효성 검사 오류가 발생한 경우 요청에 잘못된 필드 보내기 목록입니다.

error.message

string

사람이 읽을 수 있는 오류 표현입니다.

PolicyContentFormat

policyContent의 형식입니다.

Description
rawxml

콘텐츠는 인라인이며 콘텐츠 형식은 XML로 인코딩되지 않은 정책 문서입니다.

rawxml-link

정책 문서는 Xml로 인코딩되지 않으며 API Management 서비스에서 액세스할 수 있는 http 엔드포인트에서 호스트됩니다.

xml

콘텐츠는 인라인이고 콘텐츠 형식은 XML 문서입니다.

xml-link

정책 XML 문서는 API Management 서비스에서 액세스할 수 있는 http 엔드포인트에서 호스트됩니다.

PolicyContract

정책 계약 세부 정보입니다.

Name 형식 Default value Description
id

string

리소스에 대한 정규화된 리소스 ID입니다. 예 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

리소스의 이름

properties.format

PolicyContentFormat

xml

policyContent의 형식입니다.

properties.value

string

형식으로 정의된 정책의 내용입니다.

type

string

리소스의 형식입니다. 예: "Microsoft.Compute/virtualMachines" 또는 "Microsoft.Storage/storageAccounts"

PolicyExportFormat

정책 내보내기 형식입니다.

Description
rawxml

콘텐츠는 인라인이며 콘텐츠 형식은 XML로 인코딩되지 않은 정책 문서입니다.

xml

콘텐츠는 인라인이고 콘텐츠 형식은 XML 문서입니다.

PolicyIdName

정책의 식별자입니다.

Description
policy