Freigeben über


Policy - Get

Ruft die globale Richtlinienkonfiguration des API Management-Diensts ab

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

URI-Parameter

Name In Erforderlich Typ Beschreibung
policyId
path True

PolicyIdName

Der Bezeichner der Richtlinie.

resourceGroupName
path True

string

Der Name der Ressourcengruppe. Für den Namen wird die Groß-/Kleinschreibung nicht beachtet.

serviceName
path True

string

Der Name des API Management-Diensts.

RegEx-Muster: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

Hierbei handelt es sich um die ID des Zielabonnements.

api-version
query True

string

Hierbei handelt es sich um die für diesen Vorgang zu verwendende API-Version.

format
query

PolicyExportFormat

Format des Richtlinienexports.

Antworten

Name Typ Beschreibung
200 OK

PolicyContract

Ruft die globale Richtlinienkonfiguration des API Management-Diensts ab

Header

ETag: string

Other Status Codes

ErrorResponse

Fehlerantwort mit Beschreibung des Grunds für den Fehler.

Sicherheit

azure_auth

Azure Active Directory OAuth2-Flow.

Typ: oauth2
Ablauf: implicit
Autorisierungs-URL: https://login.microsoftonline.com/common/oauth2/authorize

Bereiche

Name Beschreibung
user_impersonation Identitätswechsel Ihres Benutzerkontos

Beispiele

ApiManagementGetPolicy
ApiManagementGetPolicyFormat

ApiManagementGetPolicy

Beispielanforderung

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

Beispiel für eine Antwort

{
  "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

Beispielanforderung

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

Beispiel für eine Antwort

{
  "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>"
  }
}

Definitionen

Name Beschreibung
ErrorFieldContract

Fehler Feldvertrag.

ErrorResponse

Fehlerantwort.

PolicyContentFormat

Format der richtlinieInhalt.

PolicyContract

Details zum Richtlinienvertrag.

PolicyExportFormat

Format des Richtlinienexports.

PolicyIdName

Der Bezeichner der Richtlinie.

ErrorFieldContract

Fehler Feldvertrag.

Name Typ Beschreibung
code

string

Fehlercode auf Eigenschaftsebene.

message

string

Für Menschen lesbare Darstellung eines Fehlers auf Eigenschaftsebene.

target

string

Der Eigenschaftsname.

ErrorResponse

Fehlerantwort.

Name Typ Beschreibung
error.code

string

Der vom Dienst definierte Fehlercode. Dieser Code dient als Unterstatus für den in der Antwort angegebenen HTTP-Fehlercode.

error.details

ErrorFieldContract[]

Die Liste der ungültigen Felder, die in der Anforderung gesendet werden, im Falle eines Validierungsfehlers.

error.message

string

Lesbare Darstellung des Fehlers.

PolicyContentFormat

Format der richtlinieInhalt.

Name Typ Beschreibung
rawxml

string

Der Inhalt ist inline, und der Inhaltstyp ist ein nicht XML-codiertes Richtliniendokument.

rawxml-link

string

Das Richtliniendokument ist nicht XML-codiert und wird auf einem HTTP-Endpunkt gehostet, auf den über den API Management-Dienst zugegriffen werden kann.

xml

string

Der Inhalt ist inline, und der Inhaltstyp ist ein XML-Dokument.

xml-link

string

Das XML-Richtliniendokument wird auf einem HTTP-Endpunkt gehostet, auf den über den API Management-Dienst zugegriffen werden kann.

PolicyContract

Details zum Richtlinienvertrag.

Name Typ Standardwert Beschreibung
id

string

Vollqualifizierte Ressourcen-ID für die Ressource. Beispiel: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Der Name der Ressource

properties.format

PolicyContentFormat

xml

Format der richtlinieInhalt.

properties.value

string

Inhalt der Richtlinie gemäß der Definition im Format.

type

string

Der Typ der Ressource. Z.B. "Microsoft.Compute/virtualMachines" oder "Microsoft.Storage/storageAccounts"

PolicyExportFormat

Format des Richtlinienexports.

Name Typ Beschreibung
rawxml

string

Der Inhalt ist inline, und der Inhaltstyp ist ein nicht XML-codiertes Richtliniendokument.

xml

string

Der Inhalt ist inline, und der Inhaltstyp ist ein XML-Dokument.

PolicyIdName

Der Bezeichner der Richtlinie.

Name Typ Beschreibung
policy

string