1. Packages
  2. Azure Classic
  3. API Docs
  4. authorization
  5. getUserAssignedIdentity

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.authorization.getUserAssignedIdentity

Explore with Pulumi AI

Use this data source to access information about an existing User Assigned Identity.

Example Usage

Reference An Existing)

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.authorization.getUserAssignedIdentity({
    name: "name_of_user_assigned_identity",
    resourceGroupName: "name_of_resource_group",
});
export const uaiClientId = example.then(example => example.clientId);
export const uaiPrincipalId = example.then(example => example.principalId);
export const uaiTenantId = example.then(example => example.tenantId);
Copy
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)
pulumi.export("uaiTenantId", example.tenant_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/authorization"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := authorization.LookupUserAssignedIdentity(ctx, &authorization.LookupUserAssignedIdentityArgs{
			Name:              "name_of_user_assigned_identity",
			ResourceGroupName: "name_of_resource_group",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("uaiClientId", example.ClientId)
		ctx.Export("uaiPrincipalId", example.PrincipalId)
		ctx.Export("uaiTenantId", example.TenantId)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Authorization.GetUserAssignedIdentity.Invoke(new()
    {
        Name = "name_of_user_assigned_identity",
        ResourceGroupName = "name_of_resource_group",
    });

    return new Dictionary<string, object?>
    {
        ["uaiClientId"] = example.Apply(getUserAssignedIdentityResult => getUserAssignedIdentityResult.ClientId),
        ["uaiPrincipalId"] = example.Apply(getUserAssignedIdentityResult => getUserAssignedIdentityResult.PrincipalId),
        ["uaiTenantId"] = example.Apply(getUserAssignedIdentityResult => getUserAssignedIdentityResult.TenantId),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.authorization.AuthorizationFunctions;
import com.pulumi.azure.authorization.inputs.GetUserAssignedIdentityArgs;
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) {
        final var example = AuthorizationFunctions.getUserAssignedIdentity(GetUserAssignedIdentityArgs.builder()
            .name("name_of_user_assigned_identity")
            .resourceGroupName("name_of_resource_group")
            .build());

        ctx.export("uaiClientId", example.applyValue(getUserAssignedIdentityResult -> getUserAssignedIdentityResult.clientId()));
        ctx.export("uaiPrincipalId", example.applyValue(getUserAssignedIdentityResult -> getUserAssignedIdentityResult.principalId()));
        ctx.export("uaiTenantId", example.applyValue(getUserAssignedIdentityResult -> getUserAssignedIdentityResult.tenantId()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:authorization:getUserAssignedIdentity
      arguments:
        name: name_of_user_assigned_identity
        resourceGroupName: name_of_resource_group
outputs:
  uaiClientId: ${example.clientId}
  uaiPrincipalId: ${example.principalId}
  uaiTenantId: ${example.tenantId}
Copy

Using getUserAssignedIdentity

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getUserAssignedIdentity(args: GetUserAssignedIdentityArgs, opts?: InvokeOptions): Promise<GetUserAssignedIdentityResult>
function getUserAssignedIdentityOutput(args: GetUserAssignedIdentityOutputArgs, opts?: InvokeOptions): Output<GetUserAssignedIdentityResult>
Copy
def get_user_assigned_identity(name: Optional[str] = None,
                               resource_group_name: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetUserAssignedIdentityResult
def get_user_assigned_identity_output(name: Optional[pulumi.Input[str]] = None,
                               resource_group_name: Optional[pulumi.Input[str]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetUserAssignedIdentityResult]
Copy
func LookupUserAssignedIdentity(ctx *Context, args *LookupUserAssignedIdentityArgs, opts ...InvokeOption) (*LookupUserAssignedIdentityResult, error)
func LookupUserAssignedIdentityOutput(ctx *Context, args *LookupUserAssignedIdentityOutputArgs, opts ...InvokeOption) LookupUserAssignedIdentityResultOutput
Copy

> Note: This function is named LookupUserAssignedIdentity in the Go SDK.

public static class GetUserAssignedIdentity 
{
    public static Task<GetUserAssignedIdentityResult> InvokeAsync(GetUserAssignedIdentityArgs args, InvokeOptions? opts = null)
    public static Output<GetUserAssignedIdentityResult> Invoke(GetUserAssignedIdentityInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetUserAssignedIdentityResult> getUserAssignedIdentity(GetUserAssignedIdentityArgs args, InvokeOptions options)
public static Output<GetUserAssignedIdentityResult> getUserAssignedIdentity(GetUserAssignedIdentityArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:authorization/getUserAssignedIdentity:getUserAssignedIdentity
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the User Assigned Identity.
ResourceGroupName This property is required. string
The name of the Resource Group in which the User Assigned Identity exists.
Name This property is required. string
The name of the User Assigned Identity.
ResourceGroupName This property is required. string
The name of the Resource Group in which the User Assigned Identity exists.
name This property is required. String
The name of the User Assigned Identity.
resourceGroupName This property is required. String
The name of the Resource Group in which the User Assigned Identity exists.
name This property is required. string
The name of the User Assigned Identity.
resourceGroupName This property is required. string
The name of the Resource Group in which the User Assigned Identity exists.
name This property is required. str
The name of the User Assigned Identity.
resource_group_name This property is required. str
The name of the Resource Group in which the User Assigned Identity exists.
name This property is required. String
The name of the User Assigned Identity.
resourceGroupName This property is required. String
The name of the Resource Group in which the User Assigned Identity exists.

getUserAssignedIdentity Result

The following output properties are available:

ClientId string
The Client ID of the User Assigned Identity.
Id string
The provider-assigned unique ID for this managed resource.
Location string
The Azure location where the User Assigned Identity exists.
Name string
PrincipalId string
The Service Principal ID of the User Assigned Identity.
ResourceGroupName string
Tags Dictionary<string, string>
A mapping of tags assigned to the User Assigned Identity.
TenantId string
The Tenant ID of the User Assigned Identity.
ClientId string
The Client ID of the User Assigned Identity.
Id string
The provider-assigned unique ID for this managed resource.
Location string
The Azure location where the User Assigned Identity exists.
Name string
PrincipalId string
The Service Principal ID of the User Assigned Identity.
ResourceGroupName string
Tags map[string]string
A mapping of tags assigned to the User Assigned Identity.
TenantId string
The Tenant ID of the User Assigned Identity.
clientId String
The Client ID of the User Assigned Identity.
id String
The provider-assigned unique ID for this managed resource.
location String
The Azure location where the User Assigned Identity exists.
name String
principalId String
The Service Principal ID of the User Assigned Identity.
resourceGroupName String
tags Map<String,String>
A mapping of tags assigned to the User Assigned Identity.
tenantId String
The Tenant ID of the User Assigned Identity.
clientId string
The Client ID of the User Assigned Identity.
id string
The provider-assigned unique ID for this managed resource.
location string
The Azure location where the User Assigned Identity exists.
name string
principalId string
The Service Principal ID of the User Assigned Identity.
resourceGroupName string
tags {[key: string]: string}
A mapping of tags assigned to the User Assigned Identity.
tenantId string
The Tenant ID of the User Assigned Identity.
client_id str
The Client ID of the User Assigned Identity.
id str
The provider-assigned unique ID for this managed resource.
location str
The Azure location where the User Assigned Identity exists.
name str
principal_id str
The Service Principal ID of the User Assigned Identity.
resource_group_name str
tags Mapping[str, str]
A mapping of tags assigned to the User Assigned Identity.
tenant_id str
The Tenant ID of the User Assigned Identity.
clientId String
The Client ID of the User Assigned Identity.
id String
The provider-assigned unique ID for this managed resource.
location String
The Azure location where the User Assigned Identity exists.
name String
principalId String
The Service Principal ID of the User Assigned Identity.
resourceGroupName String
tags Map<String>
A mapping of tags assigned to the User Assigned Identity.
tenantId String
The Tenant ID of the User Assigned Identity.

Package Details

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