Freigeben über


Policy - Get

Rufen Sie die globale Richtliniendefinition des API-Verwaltungsdiensts ab.

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

URI-Parameter

Name In Erforderlich Typ Beschreibung
policyId
path True

PolicyIdName

Der Bezeichner der Richtlinie.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.

serviceName
path True

string

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

Der Name des API-Verwaltungsdiensts.

subscriptionId
path True

string (uuid)

Die ID des Zielabonnements. Der Wert muss eine UUID sein.

api-version
query True

string

minLength: 1

Die API-Version, die für diesen Vorgang verwendet werden soll.

format
query

PolicyExportFormat

Format des Richtlinienexports.

Antworten

Name Typ Beschreibung
200 OK

PolicyContract

Rufen Sie die globale Richtliniendefinition des API-Verwaltungsdiensts ab.

Header

ETag: string

Other Status Codes

ErrorResponse

Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist.

Sicherheit

azure_auth

Azure Active Directory OAuth2-Fluss.

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/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy?api-version=2024-05-01

Beispiel für eine Antwort

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/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/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy?format=rawxml&api-version=2024-05-01

Beispiel für eine Antwort

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/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
ErrorAdditionalInfo

Der Ressourcenverwaltungsfehler zusätzliche Informationen.

ErrorDetail

Das Fehlerdetails.

ErrorResponse

Fehlerantwort

PolicyContentFormat

Format der policyContent.

PolicyContract

Details des Richtlinienvertrags.

PolicyExportFormat

Format des Richtlinienexports.

PolicyIdName

Der Bezeichner der Richtlinie.

ErrorAdditionalInfo

Der Ressourcenverwaltungsfehler zusätzliche Informationen.

Name Typ Beschreibung
info

object

Die zusätzlichen Informationen.

type

string

Der zusätzliche Informationstyp.

ErrorDetail

Das Fehlerdetails.

Name Typ Beschreibung
additionalInfo

ErrorAdditionalInfo[]

Die zusätzlichen Informationen des Fehlers.

code

string

Der Fehlercode.

details

ErrorDetail[]

Die Fehlerdetails.

message

string

Die Fehlermeldung.

target

string

Das Fehlerziel.

ErrorResponse

Fehlerantwort

Name Typ Beschreibung
error

ErrorDetail

Das Fehlerobjekt.

PolicyContentFormat

Format der policyContent.

Wert Beschreibung
rawxml

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

rawxml-link

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

xml

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

xml-link

Das XML-Dokument der Richtlinie wird auf einem HTTP-Endpunkt gehostet, auf den über den API-Verwaltungsdienst zugegriffen werden kann.

PolicyContract

Details des Richtlinienvertrags.

Name Typ Standardwert Beschreibung
id

string

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

name

string

Der Name der Ressource

properties.format

PolicyContentFormat

xml

Format der policyContent.

properties.value

string

Inhalt der Richtlinie gemäß definition des Formats.

type

string

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

PolicyExportFormat

Format des Richtlinienexports.

Wert Beschreibung
rawxml

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

xml

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

PolicyIdName

Der Bezeichner der Richtlinie.

Wert Beschreibung
policy