Module role
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.
Resources
Functions
Others
- AssignmentArgs
- AssignmentState
- DefinitionArgs
- DefinitionState
- GetRoleDefinitionArgs
- GetRoleDefinitionResult
Resources
Resource Assignment
class Assignment extends CustomResourceAssigns a given Principal (User or Group) to a given Role.
#### Example Usage
##### Using A Built-In Role)
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const primary = azure.core.getSubscription({});
const exampleClientConfig = azure.core.getClientConfig({});
const exampleAssignment = new azure.authorization.Assignment("exampleAssignment", {
scope: primary.then(primary => primary.id),
roleDefinitionName: "Reader",
principalId: exampleClientConfig.then(exampleClientConfig => exampleClientConfig.objectId),
});
```
##### Custom Role & Service Principal)
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const primary = azure.core.getSubscription({});
const exampleClientConfig = azure.core.getClientConfig({});
const exampleRoleDefinition = new azure.authorization.RoleDefinition("exampleRoleDefinition", {
roleDefinitionId: "00000000-0000-0000-0000-000000000000",
scope: primary.then(primary => primary.id),
permissions: [{
actions: ["Microsoft.Resources/subscriptions/resourceGroups/read"],
notActions: [],
}],
assignableScopes: [primary.then(primary => primary.id)],
});
const exampleAssignment = new azure.authorization.Assignment("exampleAssignment", {
name: "00000000-0000-0000-0000-000000000000",
scope: primary.then(primary => primary.id),
roleDefinitionId: exampleRoleDefinition.id,
principalId: exampleClientConfig.then(exampleClientConfig => exampleClientConfig.objectId),
});
```
##### Custom Role & User)
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const primary = azure.core.getSubscription({});
const exampleClientConfig = azure.core.getClientConfig({});
const exampleRoleDefinition = new azure.authorization.RoleDefinition("exampleRoleDefinition", {
roleDefinitionId: "00000000-0000-0000-0000-000000000000",
scope: primary.then(primary => primary.id),
permissions: [{
actions: ["Microsoft.Resources/subscriptions/resourceGroups/read"],
notActions: [],
}],
assignableScopes: [primary.then(primary => primary.id)],
});
const exampleAssignment = new azure.authorization.Assignment("exampleAssignment", {
name: "00000000-0000-0000-0000-000000000000",
scope: primary.then(primary => primary.id),
roleDefinitionId: exampleRoleDefinition.id,
principalId: exampleClientConfig.then(exampleClientConfig => exampleClientConfig.clientId),
});
```
##### Custom Role & Management Group)
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const primary = azure.core.getSubscription({});
const exampleClientConfig = azure.core.getClientConfig({});
const exampleGroup = azure.management.getGroup({});
const exampleRoleDefinition = new azure.authorization.RoleDefinition("exampleRoleDefinition", {
roleDefinitionId: "00000000-0000-0000-0000-000000000000",
scope: primary.then(primary => primary.id),
permissions: [{
actions: ["Microsoft.Resources/subscriptions/resourceGroups/read"],
notActions: [],
}],
assignableScopes: [primary.then(primary => primary.id)],
});
const exampleAssignment = new azure.authorization.Assignment("exampleAssignment", {
name: "00000000-0000-0000-0000-000000000000",
scope: data.azurerm_management_group.primary.id,
roleDefinitionId: exampleRoleDefinition.id,
principalId: exampleClientConfig.then(exampleClientConfig => exampleClientConfig.clientId),
});
```constructor
new Assignment(name: string, args: AssignmentArgs, opts?: pulumi.CustomResourceOptions)method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AssignmentState, opts?: pulumi.CustomResourceOptions): AssignmentGet an existing Assignment resource's state with the given name, ID, and optional extra
properties used to qualify the lookup.method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is AssignmentReturns true if the given object is an instance of Assignment. This is designed to work even
when multiple copies of the Pulumi SDK have been loaded into the same process.property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during
deployments and may be missing (undefined) during planning phases.property name
public name: pulumi.Output<string>;A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.property principalId
public principalId: pulumi.Output<string>;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.property principalType
public principalType: pulumi.Output<string>;The type of the `principalId`, e.g. User, Group, Service Principal, Application, etc.property roleDefinitionId
public roleDefinitionId: pulumi.Output<string>;The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with `roleDefinitionName`.property roleDefinitionName
public roleDefinitionName: pulumi.Output<string>;The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with `roleDefinitionId`.property scope
public scope: pulumi.Output<string>;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.property skipServicePrincipalAadCheck
public skipServicePrincipalAadCheck: pulumi.Output<boolean>;If the `principalId` is a newly provisioned `Service Principal` set this value to `true` to skip the `Azure Active Directory` check which may fail due to replication lag. This argument is only valid if the `principalId` is a `Service Principal` identity. If it is not a `Service Principal` identity it will cause the role assignment to fail. Defaults to `false`.property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after
deployments.Resource Definition
class Definition extends CustomResourceManages a custom Role Definition, used to assign Roles to Users/Principals. See ['Understand role definitions'](https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions) in the Azure documentation for more details.
#### Example Usage
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const primary = azure.core.getSubscription({});
const example = new azure.authorization.RoleDefinition("example", {
scope: primary.then(primary => primary.id),
description: "This is a custom role created",
permissions: [{
actions: ["*"],
notActions: [],
}],
assignableScopes: [primary.then(primary => primary.id)],
});
```constructor
new Definition(name: string, args: DefinitionArgs, opts?: pulumi.CustomResourceOptions)method get
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DefinitionState, opts?: pulumi.CustomResourceOptions): DefinitionGet an existing Definition resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
method getProvider
getProvider(moduleMember: string): ProviderResource | undefinedmethod isInstance
public static isInstance(obj: any): obj is DefinitionReturns true if the given object is an instance of Definition. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
property assignableScopes
public assignableScopes: pulumi.Output<string[]>;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.
property description
public description: pulumi.Output<string | undefined>;A description of the Role Definition.
property id
id: Output<ID>;id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.
property name
public name: pulumi.Output<string>;The name of the Role Definition. Changing this forces a new resource to be created.
property permissions
public permissions: pulumi.Output<DefinitionPermission[]>;A permissions block as defined below.
property roleDefinitionId
public roleDefinitionId: pulumi.Output<string>;A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
property scope
public scope: pulumi.Output<string>;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 the assignableScopes. Changing this forces a new resource to be created.
property urn
urn: Output<URN>;urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
Functions
Function getRoleDefinition
getRoleDefinition(args?: GetRoleDefinitionArgs, opts?: pulumi.InvokeOptions): Promise<GetRoleDefinitionResult>Others
interface AssignmentArgs
interface AssignmentArgsThe set of arguments for constructing a Assignment resource.
property name
name?: pulumi.Input<string>;A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
property principalId
principalId: pulumi.Input<string>;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.
property roleDefinitionId
roleDefinitionId?: pulumi.Input<string>;The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with roleDefinitionName.
property roleDefinitionName
roleDefinitionName?: pulumi.Input<string>;The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with roleDefinitionId.
property scope
scope: pulumi.Input<string>;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.
property skipServicePrincipalAadCheck
skipServicePrincipalAadCheck?: pulumi.Input<boolean>;If the principalId is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principalId is a Service Principal identity. If it is not a Service Principal identity it will cause the role assignment to fail. Defaults to false.
interface AssignmentState
interface AssignmentStateInput properties used for looking up and filtering Assignment resources.
property name
name?: pulumi.Input<string>;A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
property principalId
principalId?: pulumi.Input<string>;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.
property principalType
principalType?: pulumi.Input<string>;The type of the principalId, e.g. User, Group, Service Principal, Application, etc.
property roleDefinitionId
roleDefinitionId?: pulumi.Input<string>;The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with roleDefinitionName.
property roleDefinitionName
roleDefinitionName?: pulumi.Input<string>;The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with roleDefinitionId.
property scope
scope?: pulumi.Input<string>;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.
property skipServicePrincipalAadCheck
skipServicePrincipalAadCheck?: pulumi.Input<boolean>;If the principalId is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principalId is a Service Principal identity. If it is not a Service Principal identity it will cause the role assignment to fail. Defaults to false.
interface DefinitionArgs
interface DefinitionArgsThe set of arguments for constructing a Definition resource.
property assignableScopes
assignableScopes: pulumi.Input<pulumi.Input<string>[]>;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.
property description
description?: pulumi.Input<string>;A description of the Role Definition.
property name
name?: pulumi.Input<string>;The name of the Role Definition. Changing this forces a new resource to be created.
property permissions
permissions: pulumi.Input<pulumi.Input<DefinitionPermission>[]>;A permissions block as defined below.
property roleDefinitionId
roleDefinitionId?: pulumi.Input<string>;A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
property scope
scope: pulumi.Input<string>;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 the assignableScopes. Changing this forces a new resource to be created.
interface DefinitionState
interface DefinitionStateInput properties used for looking up and filtering Definition resources.
property assignableScopes
assignableScopes?: pulumi.Input<pulumi.Input<string>[]>;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.
property description
description?: pulumi.Input<string>;A description of the Role Definition.
property name
name?: pulumi.Input<string>;The name of the Role Definition. Changing this forces a new resource to be created.
property permissions
permissions?: pulumi.Input<pulumi.Input<DefinitionPermission>[]>;A permissions block as defined below.
property roleDefinitionId
roleDefinitionId?: pulumi.Input<string>;A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
property scope
scope?: pulumi.Input<string>;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 the assignableScopes. Changing this forces a new resource to be created.
interface GetRoleDefinitionArgs
interface GetRoleDefinitionArgsA collection of arguments for invoking getRoleDefinition.
property name
name?: undefined | string;property roleDefinitionId
roleDefinitionId?: undefined | string;property scope
scope?: undefined | string;interface GetRoleDefinitionResult
interface GetRoleDefinitionResultA collection of values returned by getRoleDefinition.
property assignableScopes
assignableScopes: string[];property description
description: string;property id
id: string;The provider-assigned unique ID for this managed resource.
property name
name: string;property permissions
permissions: GetRoleDefinitionPermission[];property roleDefinitionId
roleDefinitionId: string;property scope
scope?: undefined | string;property type
type: string;