This page documents the language specification for the azure package. If you're looking for help working with the inputs, outputs, or functions of azure resources in a Pulumi program, please see the resource documentation for examples and API reference.
authorization¶
This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the pulumi/pulumi-azure repo; however, if that doesn’t turn up anything, please consult the source terraform-providers/terraform-provider-azurerm repo.
Assigns a given Principal (User or Group) to a given Role.
import pulumi import pulumi_azure as azure primary = azure.core.get_subscription() example_client_config = azure.core.get_client_config() example_assignment = azure.authorization.Assignment("exampleAssignment", scope=primary.id, role_definition_name="Reader", principal_id=example_client_config.object_id)
import pulumi import pulumi_azure as azure primary = azure.core.get_subscription() example_client_config = azure.core.get_client_config() example_role_definition = azure.authorization.RoleDefinition("exampleRoleDefinition", role_definition_id="00000000-0000-0000-0000-000000000000", scope=primary.id, permissions=[{ "actions": ["Microsoft.Resources/subscriptions/resourceGroups/read"], "notActions": [], }], assignable_scopes=[primary.id]) example_assignment = azure.authorization.Assignment("exampleAssignment", name="00000000-0000-0000-0000-000000000000", scope=primary.id, role_definition_id=example_role_definition.id, principal_id=example_client_config.object_id)
import pulumi import pulumi_azure as azure primary = azure.core.get_subscription() example_client_config = azure.core.get_client_config() example_role_definition = azure.authorization.RoleDefinition("exampleRoleDefinition", role_definition_id="00000000-0000-0000-0000-000000000000", scope=primary.id, permissions=[{ "actions": ["Microsoft.Resources/subscriptions/resourceGroups/read"], "notActions": [], }], assignable_scopes=[primary.id]) example_assignment = azure.authorization.Assignment("exampleAssignment", name="00000000-0000-0000-0000-000000000000", scope=primary.id, role_definition_id=example_role_definition.id, principal_id=example_client_config.client_id)
import pulumi import pulumi_azure as azure primary = azure.core.get_subscription() example_client_config = azure.core.get_client_config() example_group = azure.management.get_group() example_role_definition = azure.authorization.RoleDefinition("exampleRoleDefinition", role_definition_id="00000000-0000-0000-0000-000000000000", scope=primary.id, permissions=[{ "actions": ["Microsoft.Resources/subscriptions/resourceGroups/read"], "notActions": [], }], assignable_scopes=[primary.id]) example_assignment = azure.authorization.Assignment("exampleAssignment", name="00000000-0000-0000-0000-000000000000", scope=data["azurerm_management_group"]["primary"]["id"], role_definition_id=example_role_definition.id, principal_id=example_client_config.client_id)
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
name (pulumi.Input[str]) – A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
principal_id (pulumi.Input[str]) – The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.
role_definition_id (pulumi.Input[str]) – The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with
role_definition_name.role_definition_name (pulumi.Input[str]) – The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with
role_definition_id.scope (pulumi.Input[str]) – The scope at which the Role Assignment applies to, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM, or/providers/Microsoft.Management/managementGroups/myMG. Changing this forces a new resource to be created.skip_service_principal_aad_check (pulumi.Input[bool]) – If the
principal_idis a newly provisionedService Principalset this value totrueto skip theAzure Active Directorycheck which may fail due to replication lag. This argument is only valid if theprincipal_idis aService Principalidentity. If it is not aService Principalidentity it will cause the role assignment to fail. Defaults tofalse.
A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.
The type of the
principal_id, e.g. User, Group, Service Principal, Application, etc.
The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with
role_definition_name.
The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with
role_definition_id.
The scope at which the Role Assignment applies to, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM, or/providers/Microsoft.Management/managementGroups/myMG. Changing this forces a new resource to be created.
If the
principal_idis a newly provisionedService Principalset this value totrueto skip theAzure Active Directorycheck which may fail due to replication lag. This argument is only valid if theprincipal_idis aService Principalidentity. If it is not aService Principalidentity it will cause the role assignment to fail. Defaults tofalse.
Get an existing Assignment resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
name (pulumi.Input[str]) – A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
principal_id (pulumi.Input[str]) – The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.
principal_type (pulumi.Input[str]) – The type of the
principal_id, e.g. User, Group, Service Principal, Application, etc.role_definition_id (pulumi.Input[str]) – The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with
role_definition_name.role_definition_name (pulumi.Input[str]) – The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with
role_definition_id.scope (pulumi.Input[str]) – The scope at which the Role Assignment applies to, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM, or/providers/Microsoft.Management/managementGroups/myMG. Changing this forces a new resource to be created.skip_service_principal_aad_check (pulumi.Input[bool]) – If the
principal_idis a newly provisionedService Principalset this value totrueto skip theAzure Active Directorycheck which may fail due to replication lag. This argument is only valid if theprincipal_idis aService Principalidentity. If it is not aService Principalidentity it will cause the role assignment to fail. Defaults tofalse.
Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
A collection of values returned by getRoleDefinition.
One or more assignable scopes for this Role Definition, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM.
the Description of the built-in Role.
The provider-assigned unique ID for this managed resource.
a
permissionsblock as documented below.
the Type of the Role.
A collection of values returned by getUserAssignedIdentity.
The Client ID of the User Assigned Identity.
The provider-assigned unique ID for this managed resource.
The Azure location where the User Assigned Identity exists.
The Service Principal ID of the User Assigned Identity.
A mapping of tags assigned to the User Assigned Identity.
Manages a custom Role Definition, used to assign Roles to Users/Principals. See ‘Understand role definitions’ in the Azure documentation for more details.
import pulumi import pulumi_azure as azure primary = azure.core.get_subscription() example = azure.authorization.RoleDefinition("example", scope=primary.id, description="This is a custom role created", permissions=[{ "actions": ["*"], "notActions": [], }], assignable_scopes=[primary.id])
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
assignable_scopes (pulumi.Input[list]) – One or more assignable scopes for this Role Definition, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM.description (pulumi.Input[str]) – A description of the Role Definition.
name (pulumi.Input[str]) – The name of the Role Definition. Changing this forces a new resource to be created.
permissions (pulumi.Input[list]) – A
permissionsblock as defined below.role_definition_id (pulumi.Input[str]) – A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
scope (pulumi.Input[str]) – The scope at which the Role Definition applies too, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM. It is recommended to use the first entry of theassignable_scopes. Changing this forces a new resource to be created.
The permissions object supports the following:
actions(pulumi.Input[list]) - One or more Allowed Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.dataActions(pulumi.Input[list]) - One or more Allowed Data Actions, such as*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.notActions(pulumi.Input[list]) - One or more Disallowed Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.notDataActions(pulumi.Input[list]) - One or more Disallowed Data Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
One or more assignable scopes for this Role Definition, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM.
A description of the Role Definition.
The name of the Role Definition. Changing this forces a new resource to be created.
A
permissionsblock as defined below.actions(list) - One or more Allowed Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.dataActions(list) - One or more Allowed Data Actions, such as*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.notActions(list) - One or more Disallowed Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.notDataActions(list) - One or more Disallowed Data Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
The scope at which the Role Definition applies too, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM. It is recommended to use the first entry of theassignable_scopes. Changing this forces a new resource to be created.
Get an existing RoleDefinition resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
assignable_scopes (pulumi.Input[list]) – One or more assignable scopes for this Role Definition, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM.description (pulumi.Input[str]) – A description of the Role Definition.
name (pulumi.Input[str]) – The name of the Role Definition. Changing this forces a new resource to be created.
permissions (pulumi.Input[list]) – A
permissionsblock as defined below.role_definition_id (pulumi.Input[str]) – A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
scope (pulumi.Input[str]) – The scope at which the Role Definition applies too, such as
/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM. It is recommended to use the first entry of theassignable_scopes. Changing this forces a new resource to be created.
The permissions object supports the following:
actions(pulumi.Input[list]) - One or more Allowed Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.dataActions(pulumi.Input[list]) - One or more Allowed Data Actions, such as*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.notActions(pulumi.Input[list]) - One or more Disallowed Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.notDataActions(pulumi.Input[list]) - One or more Disallowed Data Actions, such as*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
Manages a user assigned identity.
import pulumi import pulumi_azure as azure example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="eastus") example_user_assigned_identity = azure.authorization.UserAssignedIdentity("exampleUserAssignedIdentity", resource_group_name=example_resource_group.name, location=example_resource_group.location)
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
location (pulumi.Input[str]) – The location/region where the user assigned identity is created.
name (pulumi.Input[str]) – The name of the user assigned identity. Changing this forces a new identity to be created.
resource_group_name (pulumi.Input[str]) – The name of the resource group in which to create the user assigned identity.
tags (pulumi.Input[dict]) – A mapping of tags to assign to the resource.
Client ID associated with the user assigned identity.
The location/region where the user assigned identity is created.
The name of the user assigned identity. Changing this forces a new identity to be created.
Service Principal ID associated with the user assigned identity.
The name of the resource group in which to create the user assigned identity.
A mapping of tags to assign to the resource.
Get an existing UserAssignedIdentity resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
client_id (pulumi.Input[str]) – Client ID associated with the user assigned identity.
location (pulumi.Input[str]) – The location/region where the user assigned identity is created.
name (pulumi.Input[str]) – The name of the user assigned identity. Changing this forces a new identity to be created.
principal_id (pulumi.Input[str]) – Service Principal ID associated with the user assigned identity.
resource_group_name (pulumi.Input[str]) – The name of the resource group in which to create the user assigned identity.
tags (pulumi.Input[dict]) – A mapping of tags to assign to the resource.
Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
Use this data source to access information about an existing Role Definition.
- Parameters
name (str) – Specifies the Name of either a built-in or custom Role Definition.
role_definition_id (str) – Specifies the ID of the Role Definition as a UUID/GUID.
scope (str) – Specifies the Scope at which the Custom Role Definition exists.
Use this data source to access information about an existing User Assigned Identity.
import pulumi import pulumi_azure as azure example = azure.authorization.get_user_assigned_identity(name="name_of_user_assigned_identity", resource_group_name="name_of_resource_group") pulumi.export("uaiClientId", example.client_id) pulumi.export("uaiPrincipalId", example.principal_id)
- Parameters
name (str) – The name of the User Assigned Identity.
resource_group_name (str) – The name of the Resource Group in which the User Assigned Identity exists.