RoleDefinition
Manages a custom Role Definition, used to assign Roles to Users/Principals. See ‘Understand role definitions’ in the Azure documentation for more details.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var primary = Output.Create(Azure.Core.GetSubscription.InvokeAsync());
var example = new Azure.Authorization.RoleDefinition("example", new Azure.Authorization.RoleDefinitionArgs
{
Scope = primary.Apply(primary => primary.Id),
Description = "This is a custom role created",
Permissions =
{
new Azure.Authorization.Inputs.RoleDefinitionPermissionArgs
{
Actions =
{
"*",
},
NotActions = {},
},
},
AssignableScopes =
{
primary.Apply(primary => primary.Id),
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/authorization"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := core.GetSubscription(ctx, nil, nil)
if err != nil {
return err
}
_, err = authorization.NewRoleDefinition(ctx, "example", &authorization.RoleDefinitionArgs{
Scope: pulumi.String(primary.Id),
Description: pulumi.String("This is a custom role created"),
Permissions: authorization.RoleDefinitionPermissionArray{
&authorization.RoleDefinitionPermissionArgs{
Actions: pulumi.StringArray{
pulumi.String("*"),
},
NotActions: []interface{}{},
},
},
AssignableScopes: pulumi.StringArray{
pulumi.String(primary.Id),
},
})
if err != nil {
return err
}
return nil
})
}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])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)],
});Create a RoleDefinition Resource
new RoleDefinition(name: string, args: RoleDefinitionArgs, opts?: CustomResourceOptions);def RoleDefinition(resource_name, opts=None, assignable_scopes=None, description=None, name=None, permissions=None, role_definition_id=None, scope=None, __props__=None);func NewRoleDefinition(ctx *Context, name string, args RoleDefinitionArgs, opts ...ResourceOption) (*RoleDefinition, error)public RoleDefinition(string name, RoleDefinitionArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args RoleDefinitionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RoleDefinitionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RoleDefinitionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
RoleDefinition Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The RoleDefinition resource accepts the following input properties:
- Assignable
Scopes List<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.- Permissions
List<Role
Definition Permission Args> A
permissionsblock as defined below.- Scope 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 theassignable_scopes. Changing this forces a new resource to be created.- Description string
A description of the Role Definition.
- Name string
The name of the Role Definition. Changing this forces a new resource to be created.
- Role
Definition stringId A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
- Assignable
Scopes []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.- Permissions
[]Role
Definition Permission A
permissionsblock as defined below.- Scope 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 theassignable_scopes. Changing this forces a new resource to be created.- Description string
A description of the Role Definition.
- Name string
The name of the Role Definition. Changing this forces a new resource to be created.
- Role
Definition stringId A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
- assignable
Scopes 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.- permissions
Role
Definition Permission[] A
permissionsblock as defined below.- scope 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 theassignable_scopes. Changing this forces a new resource to be created.- description string
A description of the Role Definition.
- name string
The name of the Role Definition. Changing this forces a new resource to be created.
- role
Definition stringId A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
- assignable_
scopes List[str] 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.- permissions
List[Role
Definition Permission] A
permissionsblock as defined below.- scope 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.- description str
A description of the Role Definition.
- name str
The name of the Role Definition. Changing this forces a new resource to be created.
- role_
definition_ strid A unique UUID/GUID which identifies this role - one will be generated if not specified. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the RoleDefinition resource produces the following output properties:
Look up an Existing RoleDefinition Resource
Get an existing RoleDefinition resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RoleDefinitionState, opts?: CustomResourceOptions): RoleDefinitionstatic get(resource_name, id, opts=None, assignable_scopes=None, description=None, name=None, permissions=None, role_definition_id=None, scope=None, __props__=None);func GetRoleDefinition(ctx *Context, name string, id IDInput, state *RoleDefinitionState, opts ...ResourceOption) (*RoleDefinition, error)public static RoleDefinition Get(string name, Input<string> id, RoleDefinitionState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Assignable
Scopes List<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.- Description string
A description of the Role Definition.
- Name string
The name of the Role Definition. Changing this forces a new resource to be created.
- Permissions
List<Role
Definition Permission Args> A
permissionsblock as defined below.- Role
Definition stringId 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 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 theassignable_scopes. Changing this forces a new resource to be created.
- Assignable
Scopes []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.- Description string
A description of the Role Definition.
- Name string
The name of the Role Definition. Changing this forces a new resource to be created.
- Permissions
[]Role
Definition Permission A
permissionsblock as defined below.- Role
Definition stringId 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 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 theassignable_scopes. Changing this forces a new resource to be created.
- assignable
Scopes 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.- description string
A description of the Role Definition.
- name string
The name of the Role Definition. Changing this forces a new resource to be created.
- permissions
Role
Definition Permission[] A
permissionsblock as defined below.- role
Definition stringId 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 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 theassignable_scopes. Changing this forces a new resource to be created.
- assignable_
scopes List[str] 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 str
A description of the Role Definition.
- name str
The name of the Role Definition. Changing this forces a new resource to be created.
- permissions
List[Role
Definition Permission] A
permissionsblock as defined below.- role_
definition_ strid 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 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.
Supporting Types
RoleDefinitionPermission
- Actions List<string>
One or more Allowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- Data
Actions List<string> One or more Allowed Data Actions, such as
*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.- Not
Actions List<string> One or more Disallowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- Not
Data List<string>Actions One or more Disallowed Data Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
- Actions []string
One or more Allowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- Data
Actions []string One or more Allowed Data Actions, such as
*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.- Not
Actions []string One or more Disallowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- Not
Data []stringActions One or more Disallowed Data Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
- actions string[]
One or more Allowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- data
Actions string[] One or more Allowed Data Actions, such as
*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.- not
Actions string[] One or more Disallowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- not
Data string[]Actions One or more Disallowed Data Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
- actions List[str]
One or more Allowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- data
Actions List[str] One or more Allowed Data Actions, such as
*,Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. See ‘Azure Resource Manager resource provider operations’ for details.- not
Actions List[str] One or more Disallowed Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.- not
Data List[str]Actions One or more Disallowed Data Actions, such as
*,Microsoft.Resources/subscriptions/resourceGroups/read. See ‘Azure Resource Manager resource provider operations’ for details.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.