Skip to content

azurermUserAssignedIdentity

Manages a User Assigned Identity.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.userAssignedIdentity.UserAssignedIdentity(this, "example", {
  location: "${azurerm_resource_group.example.location}",
  name: "example",
  resource_group_name: "${azurerm_resource_group.example.name}",
});

Arguments Reference

The following arguments are supported:

  • location - (Required) The Azure Region where the User Assigned Identity should exist. Changing this forces a new User Assigned Identity to be created.

  • name - (Required) Specifies the name of this User Assigned Identity. Changing this forces a new User Assigned Identity to be created.

  • resourceGroupName - (Required) 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 - (Optional) A mapping of tags which should be assigned to the User Assigned Identity.

Attributes Reference

The following attributes are exported:

  • id - The ID of the User Assigned Identity.

  • clientId - The ID of the app associated with the Identity.

  • principalId - The ID of the Service Principal object associated with the created Identity.

  • tenantId - The ID of the Tenant which the Identity belongs to.


Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating this User Assigned Identity.
  • delete - (Defaults to 30 minutes) Used when deleting this User Assigned Identity.
  • read - (Defaults to 5 minutes) Used when retrieving this User Assigned Identity.
  • update - (Defaults to 30 minutes) Used when updating this User Assigned Identity.

Import

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

terraform import azurerm_user_assigned_identity.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 12345678123498764563123456789012.
  • Where {resourceGroupName} is the name of Resource Group where this User Assigned Identity exists. For example exampleResourceGroup.
  • Where {userAssignedIdentityName} is the name of the User Assigned Identity. For example userAssignedIdentityValue.