다음을 통해 공유


Workspace Policy - Get

API 수준에서 정책 구성을 가져옵니다.

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

URI 매개 변수

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

PolicyIdName

정책의 식별자입니다.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

리소스 그룹의 이름입니다. 이름은 대/소문자를 구분하지 않습니다.

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 (uuid)

대상 구독의 ID입니다. 값은 UUID여야 합니다.

workspaceId
path True

string

minLength: 1
maxLength: 80
pattern: ^[^*#&+:<>?]+$

작업 영역 식별자입니다. 현재 API Management 서비스 인스턴스에서 고유해야 합니다.

api-version
query True

string

minLength: 1

이 작업에 사용할 API 버전입니다.

format
query

PolicyExportFormat

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

응답

Name 형식 Description
200 OK

PolicyContract

작업 영역 정책 정보입니다.

헤더

ETag: string

Other Status Codes

ErrorResponse

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

보안

azure_auth

Azure Active Directory OAuth2 흐름.

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

범위

Name Description
user_impersonation 사용자 계정 가장

예제

ApiManagementGetWorkspacePolicy

샘플 요청

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policies/policy?api-version=2024-05-01

샘플 응답

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policies/policy",
  "type": "Microsoft.ApiManagement/service/workspaces/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    - Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope.\r\n    - Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope.\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    <quota-by-key calls=\"5\" bandwidth=\"2\" renewal-period=\"&#x9;P3Y6M4DT12H30M5S\" counter-key=\"ba\" />\r\n    <base />\r\n  </inbound>\r\n  <backend>\r\n    <base />\r\n  </backend>\r\n  <outbound>\r\n    <log-to-eventhub logger-id=\"apimService1\" partition-key=\"@(context.Subscription.Id)\">\r\n@{\r\n\tRandom Random = new Random();\r\n\t\t\t\tconst string Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \";                \r\n                return string.Join(\",\", DateTime.UtcNow, new string(\r\n                    Enumerable.Repeat(Chars, Random.Next(2150400))\r\n                              .Select(s =&gt; s[Random.Next(s.Length)])\r\n                              .ToArray()));\r\n          }                           \r\n                        </log-to-eventhub>\r\n    <base />\r\n  </outbound>\r\n</policies>"
  }
}

정의

Name Description
ErrorAdditionalInfo

리소스 관리 오류 추가 정보입니다.

ErrorDetail

오류 세부 정보입니다.

ErrorResponse

오류 응답

PolicyContentFormat

policyContent의 형식입니다.

PolicyContract

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

PolicyExportFormat

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

PolicyIdName

정책의 식별자입니다.

ErrorAdditionalInfo

리소스 관리 오류 추가 정보입니다.

Name 형식 Description
info

object

추가 정보입니다.

type

string

추가 정보 유형입니다.

ErrorDetail

오류 세부 정보입니다.

Name 형식 Description
additionalInfo

ErrorAdditionalInfo[]

오류 추가 정보입니다.

code

string

오류 코드입니다.

details

ErrorDetail[]

오류 세부 정보입니다.

message

string

오류 메시지입니다.

target

string

오류 대상입니다.

ErrorResponse

오류 응답

Name 형식 Description
error

ErrorDetail

오류 개체입니다.

PolicyContentFormat

policyContent의 형식입니다.

Description
xml

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

xml-link

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

rawxml

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

rawxml-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
xml

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

rawxml

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

PolicyIdName

정책의 식별자입니다.

Description
policy