1. Packages
  2. Azure Classic
  3. API Docs
  4. msi
  5. UserAssignedIdentity

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.msi.UserAssignedIdentity

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi
    Deprecated: azure.msi.UserAssignedIdentity has been deprecated in favor of azure.authorization.UserAssignedIdentity

    Manages a User Assigned Identity.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
        location: example.location,
        name: "example",
        resourceGroupName: example.name,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
        location=example.location,
        name="example",
        resource_group_name=example.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
    			Location:          example.Location,
    			Name:              pulumi.String("example"),
    			ResourceGroupName: example.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
        {
            Location = example.Location,
            Name = "example",
            ResourceGroupName = example.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.authorization.UserAssignedIdentity;
    import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
                .location(example.location())
                .name("example")
                .resourceGroupName(example.name())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleUserAssignedIdentity:
        type: azure:authorization:UserAssignedIdentity
        name: example
        properties:
          location: ${example.location}
          name: example
          resourceGroupName: ${example.name}
    

    Create UserAssignedIdentity Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new UserAssignedIdentity(name: string, args: UserAssignedIdentityArgs, opts?: CustomResourceOptions);
    @overload
    def UserAssignedIdentity(resource_name: str,
                             args: UserAssignedIdentityArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserAssignedIdentity(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             location: Optional[str] = None,
                             name: Optional[str] = None,
                             resource_group_name: Optional[str] = None,
                             tags: Optional[Mapping[str, str]] = None)
    func NewUserAssignedIdentity(ctx *Context, name string, args UserAssignedIdentityArgs, opts ...ResourceOption) (*UserAssignedIdentity, error)
    public UserAssignedIdentity(string name, UserAssignedIdentityArgs args, CustomResourceOptions? opts = null)
    public UserAssignedIdentity(String name, UserAssignedIdentityArgs args)
    public UserAssignedIdentity(String name, UserAssignedIdentityArgs args, CustomResourceOptions options)
    
    type: azure:msi:UserAssignedIdentity
    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 UserAssignedIdentityArgs
    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 UserAssignedIdentityArgs
    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 UserAssignedIdentityArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserAssignedIdentityArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserAssignedIdentityArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    UserAssignedIdentity Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The UserAssignedIdentity resource accepts the following input properties:

    ResourceGroupName string
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Location string
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Name string
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the User Assigned Identity.
    ResourceGroupName string
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Location string
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Name string
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    Tags map[string]string
    A mapping of tags which should be assigned to the User Assigned Identity.
    resourceGroupName String
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    location String
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name String
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    tags Map<String,String>
    A mapping of tags which should be assigned to the User Assigned Identity.
    resourceGroupName string
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    location string
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name string
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the User Assigned Identity.
    resource_group_name str
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    location str
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name str
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the User Assigned Identity.
    resourceGroupName String
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    location String
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name String
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    tags Map<String>
    A mapping of tags which should be assigned to the User Assigned Identity.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the UserAssignedIdentity resource produces the following output properties:

    ClientId string
    The ID of the app associated with the Identity.
    Id string
    The provider-assigned unique ID for this managed resource.
    PrincipalId string
    The ID of the Service Principal object associated with the created Identity.
    TenantId string
    The ID of the Tenant which the Identity belongs to.
    ClientId string
    The ID of the app associated with the Identity.
    Id string
    The provider-assigned unique ID for this managed resource.
    PrincipalId string
    The ID of the Service Principal object associated with the created Identity.
    TenantId string
    The ID of the Tenant which the Identity belongs to.
    clientId String
    The ID of the app associated with the Identity.
    id String
    The provider-assigned unique ID for this managed resource.
    principalId String
    The ID of the Service Principal object associated with the created Identity.
    tenantId String
    The ID of the Tenant which the Identity belongs to.
    clientId string
    The ID of the app associated with the Identity.
    id string
    The provider-assigned unique ID for this managed resource.
    principalId string
    The ID of the Service Principal object associated with the created Identity.
    tenantId string
    The ID of the Tenant which the Identity belongs to.
    client_id str
    The ID of the app associated with the Identity.
    id str
    The provider-assigned unique ID for this managed resource.
    principal_id str
    The ID of the Service Principal object associated with the created Identity.
    tenant_id str
    The ID of the Tenant which the Identity belongs to.
    clientId String
    The ID of the app associated with the Identity.
    id String
    The provider-assigned unique ID for this managed resource.
    principalId String
    The ID of the Service Principal object associated with the created Identity.
    tenantId String
    The ID of the Tenant which the Identity belongs to.

    Look up Existing UserAssignedIdentity Resource

    Get an existing UserAssignedIdentity 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?: UserAssignedIdentityState, opts?: CustomResourceOptions): UserAssignedIdentity
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_id: Optional[str] = None,
            location: Optional[str] = None,
            name: Optional[str] = None,
            principal_id: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tenant_id: Optional[str] = None) -> UserAssignedIdentity
    func GetUserAssignedIdentity(ctx *Context, name string, id IDInput, state *UserAssignedIdentityState, opts ...ResourceOption) (*UserAssignedIdentity, error)
    public static UserAssignedIdentity Get(string name, Input<string> id, UserAssignedIdentityState? state, CustomResourceOptions? opts = null)
    public static UserAssignedIdentity get(String name, Output<String> id, UserAssignedIdentityState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    ClientId string
    The ID of the app associated with the Identity.
    Location string
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Name string
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    PrincipalId string
    The ID of the Service Principal object associated with the created Identity.
    ResourceGroupName string
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the User Assigned Identity.
    TenantId string
    The ID of the Tenant which the Identity belongs to.
    ClientId string
    The ID of the app associated with the Identity.
    Location string
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Name string
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    PrincipalId string
    The ID of the Service Principal object associated with the created Identity.
    ResourceGroupName string
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    Tags map[string]string
    A mapping of tags which should be assigned to the User Assigned Identity.
    TenantId string
    The ID of the Tenant which the Identity belongs to.
    clientId String
    The ID of the app associated with the Identity.
    location String
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name String
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    principalId String
    The ID of the Service Principal object associated with the created Identity.
    resourceGroupName String
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    tags Map<String,String>
    A mapping of tags which should be assigned to the User Assigned Identity.
    tenantId String
    The ID of the Tenant which the Identity belongs to.
    clientId string
    The ID of the app associated with the Identity.
    location string
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name string
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    principalId string
    The ID of the Service Principal object associated with the created Identity.
    resourceGroupName string
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the User Assigned Identity.
    tenantId string
    The ID of the Tenant which the Identity belongs to.
    client_id str
    The ID of the app associated with the Identity.
    location str
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name str
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    principal_id str
    The ID of the Service Principal object associated with the created Identity.
    resource_group_name str
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the User Assigned Identity.
    tenant_id str
    The ID of the Tenant which the Identity belongs to.
    clientId String
    The ID of the app associated with the Identity.
    location String
    The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    name String
    Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.
    principalId String
    The ID of the Service Principal object associated with the created Identity.
    resourceGroupName String
    Specifies the name of the Resource Group within which this User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.
    tags Map<String>
    A mapping of tags which should be assigned to the User Assigned Identity.
    tenantId String
    The ID of the Tenant which the Identity belongs to.

    Import

    An existing User Assigned Identity can be imported into Terraform using the resource id, e.g.

    $ pulumi import azure:msi/userAssignedIdentity:UserAssignedIdentity example /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}
    
    • Where {subscriptionId} is the ID of the Azure Subscription where the User Assigned Identity exists. For example 12345678-1234-9876-4563-123456789012.

    • Where {resourceGroupName} is the name of Resource Group where this User Assigned Identity exists. For example example-resource-group.

    • Where {userAssignedIdentityName} is the name of the User Assigned Identity. For example userAssignedIdentityValue.

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi