New-AzureRmUserAssignedIdentity
Creates a new User Assigned Identity or updates an existing User Assigned Identity.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
New-AzureRmUserAssignedIdentity
[-ResourceGroupName] <String>
[-Name] <String>
[-Location <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-Tag <Hashtable>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzureRmUserAssignedIdentity cmdlet creates a new User Assigned Identity. When used with an already existing identity, it updated the identity. To add Azure Resource Manager tags to the identity, please use the Set-AzureRmResource cmdlet.
Examples
Example 1
This example cmdlet creates a new User Assigned Identity with name ID1 under resource group PSRG in the location of the ResourceGroup.
PS C:\> New-AzureRmUserAssignedIdentity -ResourceGroupName PSRG -Name ID1
Id : /subscriptions/586d0246-0344-49dc-a790-59c916b0c309/resourcegroups/PSRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID1
ResourceGroupName : PSRG
Name : ID1
Location : centralus
TenantId : 493b860d-2741-480b-8b34-7b1d76e33c50
PrincipalId : e34192f9-7831-4a02-bfe2-4c6d2fb4360d
ClientId : a5e650a2-fdfe-4652-bb3b-109b64617cfd
ClientSecretUrl : https://control-westus.identity.azure.net/subscriptions/586d0246-0344-49dc-a790-59c916b0c309/resourcegroups/PSRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID1/credentials?tid=493b860d-2741-480b-8b34-7b1d76e33c50&oid=e34192f9-7831-4a02-bfe2-4c6d2fb4360d&aid=a5e650a2-fdfe-4652-bb3b-109b64617cfd
Type : Microsoft.ManagedIdentity/userAssignedIdentities
Example 2
This example cmdlet creates a new User Assigned Identity with name ID1 under the resource group PSRG in the westus region.
PS C:\> New-AzureRmUserAssignedIdentity -ResourceGroupName PSRG -Name ID1 -Location westus
Id : /subscriptions/586d0246-0344-49dc-a790-59c916b0c309/resourcegroups/PSRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID1
ResourceGroupName : PSRG
Name : ID1
Location : westus
TenantId : 493b860d-2741-480b-8b34-7b1d76e33c50
PrincipalId : e34192f9-7831-4a02-bfe2-4c6d2fb4360d
ClientId : a5e650a2-fdfe-4652-bb3b-109b64617cfd
ClientSecretUrl : https://control-westus.identity.azure.net/subscriptions/586d0246-0344-49dc-a790-59c916b0c309/resourcegroups/PSRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID1/credentials?tid=493b860d-2741-480b-8b34-7b1d76e33c50&oid=e34192f9-7831-4a02-bfe2-4c6d2fb4360d&aid=a5e650a2-fdfe-4652-bb3b-109b64617cfd
Type : Microsoft.ManagedIdentity/userAssignedIdentities
Parameters
-AsJob
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
The Azure region name where the Identity should be created.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
The Identity name.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
The resource group name.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Tag
The Azure Resource Manager tags associated with the identity.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Outputs
Microsoft.Azure.Commands.ManagedServiceIdentity.Models.PsUserAssignedIdentity