azure-native.apimanagement.Authorization
Explore with Pulumi AI
Authorization contract. Azure REST API version: 2022-08-01.
Other available API versions: 2022-09-01-preview, 2023-03-01-preview, 2023-05-01-preview, 2023-09-01-preview, 2024-05-01, 2024-06-01-preview.
Example Usage
ApiManagementCreateAuthorizationAADAuthCode
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() => 
{
    var authorization = new AzureNative.ApiManagement.Authorization("authorization", new()
    {
        AuthorizationId = "authz2",
        AuthorizationProviderId = "aadwithauthcode",
        AuthorizationType = AzureNative.ApiManagement.AuthorizationType.OAuth2,
        OAuth2GrantType = AzureNative.ApiManagement.OAuth2GrantType.AuthorizationCode,
        ResourceGroupName = "rg1",
        ServiceName = "apimService1",
    });
});
package main
import (
	apimanagement "github.com/pulumi/pulumi-azure-native-sdk/apimanagement/v2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apimanagement.NewAuthorization(ctx, "authorization", &apimanagement.AuthorizationArgs{
			AuthorizationId:         pulumi.String("authz2"),
			AuthorizationProviderId: pulumi.String("aadwithauthcode"),
			AuthorizationType:       pulumi.String(apimanagement.AuthorizationTypeOAuth2),
			OAuth2GrantType:         pulumi.String(apimanagement.OAuth2GrantTypeAuthorizationCode),
			ResourceGroupName:       pulumi.String("rg1"),
			ServiceName:             pulumi.String("apimService1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.apimanagement.Authorization;
import com.pulumi.azurenative.apimanagement.AuthorizationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        var authorization = new Authorization("authorization", AuthorizationArgs.builder()
            .authorizationId("authz2")
            .authorizationProviderId("aadwithauthcode")
            .authorizationType("OAuth2")
            .oAuth2GrantType("AuthorizationCode")
            .resourceGroupName("rg1")
            .serviceName("apimService1")
            .build());
    }
}
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";
const authorization = new azure_native.apimanagement.Authorization("authorization", {
    authorizationId: "authz2",
    authorizationProviderId: "aadwithauthcode",
    authorizationType: azure_native.apimanagement.AuthorizationType.OAuth2,
    oAuth2GrantType: azure_native.apimanagement.OAuth2GrantType.AuthorizationCode,
    resourceGroupName: "rg1",
    serviceName: "apimService1",
});
import pulumi
import pulumi_azure_native as azure_native
authorization = azure_native.apimanagement.Authorization("authorization",
    authorization_id="authz2",
    authorization_provider_id="aadwithauthcode",
    authorization_type=azure_native.apimanagement.AuthorizationType.O_AUTH2,
    o_auth2_grant_type=azure_native.apimanagement.OAuth2GrantType.AUTHORIZATION_CODE,
    resource_group_name="rg1",
    service_name="apimService1")
resources:
  authorization:
    type: azure-native:apimanagement:Authorization
    properties:
      authorizationId: authz2
      authorizationProviderId: aadwithauthcode
      authorizationType: OAuth2
      oAuth2GrantType: AuthorizationCode
      resourceGroupName: rg1
      serviceName: apimService1
ApiManagementCreateAuthorizationAADClientCred
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() => 
{
    var authorization = new AzureNative.ApiManagement.Authorization("authorization", new()
    {
        AuthorizationId = "authz1",
        AuthorizationProviderId = "aadwithclientcred",
        AuthorizationType = AzureNative.ApiManagement.AuthorizationType.OAuth2,
        OAuth2GrantType = AzureNative.ApiManagement.OAuth2GrantType.AuthorizationCode,
        Parameters = 
        {
            { "clientId", "53790925-fdd3-4b80-bc7a-4c3aaf25801d" },
            { "clientSecret", "xxxxxxxxxxxxxxx~xxxxxxxxx" },
        },
        ResourceGroupName = "rg1",
        ServiceName = "apimService1",
    });
});
package main
import (
	apimanagement "github.com/pulumi/pulumi-azure-native-sdk/apimanagement/v2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apimanagement.NewAuthorization(ctx, "authorization", &apimanagement.AuthorizationArgs{
			AuthorizationId:         pulumi.String("authz1"),
			AuthorizationProviderId: pulumi.String("aadwithclientcred"),
			AuthorizationType:       pulumi.String(apimanagement.AuthorizationTypeOAuth2),
			OAuth2GrantType:         pulumi.String(apimanagement.OAuth2GrantTypeAuthorizationCode),
			Parameters: pulumi.StringMap{
				"clientId":     pulumi.String("53790925-fdd3-4b80-bc7a-4c3aaf25801d"),
				"clientSecret": pulumi.String("xxxxxxxxxxxxxxx~xxxxxxxxx"),
			},
			ResourceGroupName: pulumi.String("rg1"),
			ServiceName:       pulumi.String("apimService1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.apimanagement.Authorization;
import com.pulumi.azurenative.apimanagement.AuthorizationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        var authorization = new Authorization("authorization", AuthorizationArgs.builder()
            .authorizationId("authz1")
            .authorizationProviderId("aadwithclientcred")
            .authorizationType("OAuth2")
            .oAuth2GrantType("AuthorizationCode")
            .parameters(Map.ofEntries(
                Map.entry("clientId", "53790925-fdd3-4b80-bc7a-4c3aaf25801d"),
                Map.entry("clientSecret", "xxxxxxxxxxxxxxx~xxxxxxxxx")
            ))
            .resourceGroupName("rg1")
            .serviceName("apimService1")
            .build());
    }
}
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";
const authorization = new azure_native.apimanagement.Authorization("authorization", {
    authorizationId: "authz1",
    authorizationProviderId: "aadwithclientcred",
    authorizationType: azure_native.apimanagement.AuthorizationType.OAuth2,
    oAuth2GrantType: azure_native.apimanagement.OAuth2GrantType.AuthorizationCode,
    parameters: {
        clientId: "53790925-fdd3-4b80-bc7a-4c3aaf25801d",
        clientSecret: "xxxxxxxxxxxxxxx~xxxxxxxxx",
    },
    resourceGroupName: "rg1",
    serviceName: "apimService1",
});
import pulumi
import pulumi_azure_native as azure_native
authorization = azure_native.apimanagement.Authorization("authorization",
    authorization_id="authz1",
    authorization_provider_id="aadwithclientcred",
    authorization_type=azure_native.apimanagement.AuthorizationType.O_AUTH2,
    o_auth2_grant_type=azure_native.apimanagement.OAuth2GrantType.AUTHORIZATION_CODE,
    parameters={
        "clientId": "53790925-fdd3-4b80-bc7a-4c3aaf25801d",
        "clientSecret": "xxxxxxxxxxxxxxx~xxxxxxxxx",
    },
    resource_group_name="rg1",
    service_name="apimService1")
resources:
  authorization:
    type: azure-native:apimanagement:Authorization
    properties:
      authorizationId: authz1
      authorizationProviderId: aadwithclientcred
      authorizationType: OAuth2
      oAuth2GrantType: AuthorizationCode
      parameters:
        clientId: 53790925-fdd3-4b80-bc7a-4c3aaf25801d
        clientSecret: xxxxxxxxxxxxxxx~xxxxxxxxx
      resourceGroupName: rg1
      serviceName: apimService1
Create Authorization Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Authorization(name: string, args: AuthorizationArgs, opts?: CustomResourceOptions);@overload
def Authorization(resource_name: str,
                  args: AuthorizationArgs,
                  opts: Optional[ResourceOptions] = None)
@overload
def Authorization(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  authorization_provider_id: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  service_name: Optional[str] = None,
                  authorization_id: Optional[str] = None,
                  authorization_type: Optional[Union[str, AuthorizationType]] = None,
                  error: Optional[AuthorizationErrorArgs] = None,
                  o_auth2_grant_type: Optional[Union[str, OAuth2GrantType]] = None,
                  parameters: Optional[Mapping[str, str]] = None,
                  status: Optional[str] = None)func NewAuthorization(ctx *Context, name string, args AuthorizationArgs, opts ...ResourceOption) (*Authorization, error)public Authorization(string name, AuthorizationArgs args, CustomResourceOptions? opts = null)
public Authorization(String name, AuthorizationArgs args)
public Authorization(String name, AuthorizationArgs args, CustomResourceOptions options)
type: azure-native:apimanagement:Authorization
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AuthorizationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AuthorizationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AuthorizationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AuthorizationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AuthorizationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var authorizationResource = new AzureNative.ApiManagement.Authorization("authorizationResource", new()
{
    AuthorizationProviderId = "string",
    ResourceGroupName = "string",
    ServiceName = "string",
    AuthorizationId = "string",
    AuthorizationType = "string",
    Error = new AzureNative.ApiManagement.Inputs.AuthorizationErrorArgs
    {
        Code = "string",
        Message = "string",
    },
    OAuth2GrantType = "string",
    Parameters = 
    {
        { "string", "string" },
    },
    Status = "string",
});
example, err := apimanagement.NewAuthorization(ctx, "authorizationResource", &apimanagement.AuthorizationArgs{
	AuthorizationProviderId: pulumi.String("string"),
	ResourceGroupName:       pulumi.String("string"),
	ServiceName:             pulumi.String("string"),
	AuthorizationId:         pulumi.String("string"),
	AuthorizationType:       pulumi.String("string"),
	Error: &apimanagement.AuthorizationErrorArgs{
		Code:    pulumi.String("string"),
		Message: pulumi.String("string"),
	},
	OAuth2GrantType: pulumi.String("string"),
	Parameters: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Status: pulumi.String("string"),
})
var authorizationResource = new Authorization("authorizationResource", AuthorizationArgs.builder()
    .authorizationProviderId("string")
    .resourceGroupName("string")
    .serviceName("string")
    .authorizationId("string")
    .authorizationType("string")
    .error(AuthorizationErrorArgs.builder()
        .code("string")
        .message("string")
        .build())
    .oAuth2GrantType("string")
    .parameters(Map.of("string", "string"))
    .status("string")
    .build());
authorization_resource = azure_native.apimanagement.Authorization("authorizationResource",
    authorization_provider_id="string",
    resource_group_name="string",
    service_name="string",
    authorization_id="string",
    authorization_type="string",
    error={
        "code": "string",
        "message": "string",
    },
    o_auth2_grant_type="string",
    parameters={
        "string": "string",
    },
    status="string")
const authorizationResource = new azure_native.apimanagement.Authorization("authorizationResource", {
    authorizationProviderId: "string",
    resourceGroupName: "string",
    serviceName: "string",
    authorizationId: "string",
    authorizationType: "string",
    error: {
        code: "string",
        message: "string",
    },
    oAuth2GrantType: "string",
    parameters: {
        string: "string",
    },
    status: "string",
});
type: azure-native:apimanagement:Authorization
properties:
    authorizationId: string
    authorizationProviderId: string
    authorizationType: string
    error:
        code: string
        message: string
    oAuth2GrantType: string
    parameters:
        string: string
    resourceGroupName: string
    serviceName: string
    status: string
Authorization Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Authorization resource accepts the following input properties:
- string
- Identifier of the authorization provider.
- ResourceGroup stringName 
- The name of the resource group. The name is case insensitive.
- ServiceName string
- The name of the API Management service.
- string
- Identifier of the authorization.
- 
string | Pulumi.Azure Native. Api Management. Authorization Type 
- Authorization type options
- Error
Pulumi.Azure Native. Api Management. Inputs. Authorization Error 
- Authorization error details.
- OAuth2GrantType string | Pulumi.Azure Native. Api Management. OAuth2Grant Type 
- OAuth2 grant type options
- Parameters Dictionary<string, string>
- Authorization parameters
- Status string
- Status of the Authorization
- string
- Identifier of the authorization provider.
- ResourceGroup stringName 
- The name of the resource group. The name is case insensitive.
- ServiceName string
- The name of the API Management service.
- string
- Identifier of the authorization.
- 
string | AuthorizationType 
- Authorization type options
- Error
AuthorizationError Args 
- Authorization error details.
- OAuth2GrantType string | OAuth2GrantType 
- OAuth2 grant type options
- Parameters map[string]string
- Authorization parameters
- Status string
- Status of the Authorization
- String
- Identifier of the authorization provider.
- resourceGroup StringName 
- The name of the resource group. The name is case insensitive.
- serviceName String
- The name of the API Management service.
- String
- Identifier of the authorization.
- 
String | AuthorizationType 
- Authorization type options
- error
AuthorizationError 
- Authorization error details.
- oAuth2Grant String | OAuth2GrantType Type 
- OAuth2 grant type options
- parameters Map<String,String>
- Authorization parameters
- status String
- Status of the Authorization
- string
- Identifier of the authorization provider.
- resourceGroup stringName 
- The name of the resource group. The name is case insensitive.
- serviceName string
- The name of the API Management service.
- string
- Identifier of the authorization.
- 
string | AuthorizationType 
- Authorization type options
- error
AuthorizationError 
- Authorization error details.
- oAuth2Grant string | OAuth2GrantType Type 
- OAuth2 grant type options
- parameters {[key: string]: string}
- Authorization parameters
- status string
- Status of the Authorization
- str
- Identifier of the authorization provider.
- resource_group_ strname 
- The name of the resource group. The name is case insensitive.
- service_name str
- The name of the API Management service.
- str
- Identifier of the authorization.
- 
str | AuthorizationType 
- Authorization type options
- error
AuthorizationError Args 
- Authorization error details.
- o_auth2_ str | OAuth2Grantgrant_ type Type 
- OAuth2 grant type options
- parameters Mapping[str, str]
- Authorization parameters
- status str
- Status of the Authorization
- String
- Identifier of the authorization provider.
- resourceGroup StringName 
- The name of the resource group. The name is case insensitive.
- serviceName String
- The name of the API Management service.
- String
- Identifier of the authorization.
- String | "OAuth2"
- Authorization type options
- error Property Map
- Authorization error details.
- oAuth2Grant String | "AuthorizationType Code" | "Client Credentials" 
- OAuth2 grant type options
- parameters Map<String>
- Authorization parameters
- status String
- Status of the Authorization
Outputs
All input properties are implicitly available as output properties. Additionally, the Authorization resource produces the following output properties:
Supporting Types
AuthorizationError, AuthorizationErrorArgs    
AuthorizationErrorResponse, AuthorizationErrorResponseArgs      
AuthorizationType, AuthorizationTypeArgs    
- OAuth2
- OAuth2OAuth2 authorization type
- AuthorizationType OAuth2 
- OAuth2OAuth2 authorization type
- OAuth2
- OAuth2OAuth2 authorization type
- OAuth2
- OAuth2OAuth2 authorization type
- O_AUTH2
- OAuth2OAuth2 authorization type
- "OAuth2"
- OAuth2OAuth2 authorization type
OAuth2GrantType, OAuth2GrantTypeArgs    
- AuthorizationCode 
- AuthorizationCodeAuthorization Code grant
- ClientCredentials 
- ClientCredentialsClient Credential grant
- OAuth2GrantType Authorization Code 
- AuthorizationCodeAuthorization Code grant
- OAuth2GrantType Client Credentials 
- ClientCredentialsClient Credential grant
- AuthorizationCode 
- AuthorizationCodeAuthorization Code grant
- ClientCredentials 
- ClientCredentialsClient Credential grant
- AuthorizationCode 
- AuthorizationCodeAuthorization Code grant
- ClientCredentials 
- ClientCredentialsClient Credential grant
- AUTHORIZATION_CODE
- AuthorizationCodeAuthorization Code grant
- CLIENT_CREDENTIALS
- ClientCredentialsClient Credential grant
- "AuthorizationCode" 
- AuthorizationCodeAuthorization Code grant
- "ClientCredentials" 
- ClientCredentialsClient Credential grant
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:apimanagement:Authorization authz1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} 
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Native pulumi/pulumi-azure-native
- License
- Apache-2.0