Udostępnij za pośrednictwem


Authorization Provider - Create Or Update

Tworzy lub aktualizuje dostawcę autoryzacji.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}?api-version=2024-05-01

Parametry identyfikatora URI

Nazwa W Wymagane Typ Opis
authorizationProviderId
path True

string

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

Identyfikator dostawcy autoryzacji.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.

serviceName
path True

string

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

Nazwa usługi API Management.

subscriptionId
path True

string (uuid)

Identyfikator subskrypcji docelowej. Wartość musi być identyfikatorem UUID.

api-version
query True

string

minLength: 1

Wersja interfejsu API do użycia dla tej operacji.

Nagłówek żądania

Nazwa Wymagane Typ Opis
If-Match

string

Element ETag jednostki. Nie jest to wymagane podczas tworzenia jednostki, ale wymagane podczas aktualizowania jednostki.

Treść żądania

Nazwa Typ Opis
properties.displayName

string

minLength: 1
maxLength: 300

Nazwa dostawcy autoryzacji. Musi mieć długość od 1 do 300 znaków.

properties.identityProvider

string

Nazwa dostawcy tożsamości. Musi mieć długość od 1 do 300 znaków.

properties.oauth2

AuthorizationProviderOAuth2Settings

Ustawienia protokołu OAuth2

Odpowiedzi

Nazwa Typ Opis
200 OK

AuthorizationProviderContract

Istniejący dostawca autoryzacji został pomyślnie zaktualizowany.

Nagłówki

ETag: string

201 Created

AuthorizationProviderContract

Dostawca autoryzacji został pomyślnie utworzony.

Nagłówki

ETag: string

Other Status Codes

ErrorResponse

Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.

Zabezpieczenia

azure_auth

Przepływ protokołu OAuth2 usługi Azure Active Directory.

Typ: oauth2
Flow: implicit
Adres URL autoryzacji: https://login.microsoftonline.com/common/oauth2/authorize

Zakresy

Nazwa Opis
user_impersonation personifikacja konta użytkownika

Przykłady

ApiManagementCreateAuthorizationProviderAADAuthCode
ApiManagementCreateAuthorizationProviderAADClientCred
ApiManagementCreateAuthorizationProviderGenericOAuth2
ApiManagementCreateAuthorizationProviderOOBGoogle

ApiManagementCreateAuthorizationProviderAADAuthCode

Przykładowe żądanie

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithauthcode?api-version=2024-05-01

{
  "properties": {
    "displayName": "aadwithauthcode",
    "identityProvider": "aad",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "clientsecretid",
          "clientSecret": "clientsecretvalue",
          "scopes": "User.Read.All Group.Read.All",
          "resourceUri": "https://graph.microsoft.com"
        }
      }
    }
  }
}

Przykładowa odpowiedź

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithauthcode",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "aadwithauthcode",
  "properties": {
    "displayName": "aadwithauthcode",
    "identityProvider": "aad",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "53790825-fdd3-4b80-bc7a-4c3aaf25801d",
          "scopes": "User.Read.All Group.Read.All",
          "loginUri": "https://login.windows.net",
          "resourceUri": "https://graph.microsoft.com",
          "tenantId": "common"
        }
      }
    }
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithauthcode",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "aadwithauthcode",
  "properties": {
    "displayName": "aadwithauthcode",
    "identityProvider": "aad",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "53790825-fdd3-4b80-bc7a-4c3aaf25801d",
          "scopes": "User.Read.All Group.Read.All",
          "loginUri": "https://login.windows.net",
          "resourceUri": "https://graph.microsoft.com",
          "tenantId": "common"
        }
      }
    }
  }
}

ApiManagementCreateAuthorizationProviderAADClientCred

Przykładowe żądanie

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithclientcred?api-version=2024-05-01

{
  "properties": {
    "displayName": "aadwithclientcred",
    "identityProvider": "aad",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "scopes": "User.Read.All Group.Read.All",
          "resourceUri": "https://graph.microsoft.com"
        }
      }
    }
  }
}

Przykładowa odpowiedź

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithclientcred",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "aadwithclientcred",
  "properties": {
    "displayName": "aadwithclientcred",
    "identityProvider": "aad",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "clientCredentials": {
          "scopes": "User.Read.All Group.Read.All",
          "loginUri": "https://login.windows.net",
          "resourceUri": "https://graph.microsoft.com",
          "tenantId": "common"
        }
      }
    }
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithclientcred",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "aadwithclientcred",
  "properties": {
    "displayName": "aadwithclientcred",
    "identityProvider": "aad",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "clientCredentials": {
          "scopes": "User.Read.All Group.Read.All",
          "loginUri": "https://login.windows.net",
          "resourceUri": "https://graph.microsoft.com",
          "tenantId": "common"
        }
      }
    }
  }
}

ApiManagementCreateAuthorizationProviderGenericOAuth2

Przykładowe żądanie

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/eventbrite?api-version=2024-05-01

{
  "properties": {
    "displayName": "eventbrite",
    "identityProvider": "oauth2",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "clientid",
          "clientSecret": "clientsecretvalue",
          "scopes": null,
          "authorizationUrl": "https://www.eventbrite.com/oauth/authorize",
          "refreshUrl": "https://www.eventbrite.com/oauth/token",
          "tokenUrl": "https://www.eventbrite.com/oauth/token"
        }
      }
    }
  }
}

Przykładowa odpowiedź

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/eventbrite",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "eventbrite",
  "properties": {
    "displayName": "eventbrite",
    "identityProvider": "oauth2",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "clientid",
          "scopes": null,
          "authorizationUrl": "https://www.eventbrite.com/oauth/authorize",
          "refreshUrl": "https://www.eventbrite.com/oauth/token",
          "tokenUrl": "https://www.eventbrite.com/oauth/token"
        }
      }
    }
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/eventbrite",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "eventbrite",
  "properties": {
    "displayName": "eventbrite",
    "identityProvider": "oauth2",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "clientid",
          "scopes": null,
          "authorizationUrl": "https://www.eventbrite.com/oauth/authorize",
          "refreshUrl": "https://www.eventbrite.com/oauth/token",
          "tokenUrl": "https://www.eventbrite.com/oauth/token"
        }
      }
    }
  }
}

ApiManagementCreateAuthorizationProviderOOBGoogle

Przykładowe żądanie

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/google?api-version=2024-05-01

{
  "properties": {
    "displayName": "google",
    "identityProvider": "google",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
          "clientSecret": "clientsecretvalue",
          "scopes": "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"
        }
      }
    }
  }
}

Przykładowa odpowiedź

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/google",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "google",
  "properties": {
    "displayName": "google",
    "identityProvider": "google",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
          "scopes": "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"
        }
      }
    }
  }
}
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/google",
  "type": "Microsoft.ApiManagement/service/authorizationProviders",
  "name": "google",
  "properties": {
    "displayName": "google",
    "identityProvider": "google",
    "oauth2": {
      "redirectUrl": "https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1",
      "grantTypes": {
        "authorizationCode": {
          "clientId": "99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
          "scopes": "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"
        }
      }
    }
  }
}

Definicje

Nazwa Opis
AuthorizationProviderContract

Kontrakt dostawcy autoryzacji.

AuthorizationProviderOAuth2GrantTypes

Ustawienia typów udzielania oauth2 dostawcy autoryzacji

AuthorizationProviderOAuth2Settings

Szczegóły ustawień protokołu OAuth2

ErrorAdditionalInfo

Dodatkowe informacje o błędzie zarządzania zasobami.

ErrorDetail

Szczegóły błędu.

ErrorResponse

Odpowiedź na błąd

AuthorizationProviderContract

Kontrakt dostawcy autoryzacji.

Nazwa Typ Opis
id

string

W pełni kwalifikowany identyfikator zasobu dla zasobu. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Nazwa zasobu

properties.displayName

string

minLength: 1
maxLength: 300

Nazwa dostawcy autoryzacji. Musi mieć długość od 1 do 300 znaków.

properties.identityProvider

string

Nazwa dostawcy tożsamości. Musi mieć długość od 1 do 300 znaków.

properties.oauth2

AuthorizationProviderOAuth2Settings

Ustawienia protokołu OAuth2

type

string

Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"

AuthorizationProviderOAuth2GrantTypes

Ustawienia typów udzielania oauth2 dostawcy autoryzacji

Nazwa Typ Opis
authorizationCode

object

Parametry udzielania kodu autoryzacji OAuth2

clientCredentials

object

Parametry udzielania poświadczeń klienta OAuth2

AuthorizationProviderOAuth2Settings

Szczegóły ustawień protokołu OAuth2

Nazwa Typ Opis
grantTypes

AuthorizationProviderOAuth2GrantTypes

Ustawienia protokołu OAuth2

redirectUrl

string

Adres URL przekierowania do ustawienia w aplikacji OAuth.

ErrorAdditionalInfo

Dodatkowe informacje o błędzie zarządzania zasobami.

Nazwa Typ Opis
info

object

Dodatkowe informacje.

type

string

Dodatkowy typ informacji.

ErrorDetail

Szczegóły błędu.

Nazwa Typ Opis
additionalInfo

ErrorAdditionalInfo[]

Dodatkowe informacje o błędzie.

code

string

Kod błędu.

details

ErrorDetail[]

Szczegóły błędu.

message

string

Komunikat o błędzie.

target

string

Element docelowy błędu.

ErrorResponse

Odpowiedź na błąd

Nazwa Typ Opis
error

ErrorDetail

Obiekt błędu.