Get-AzureRmKeyVault
Gets key vaults.
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
Get-AzureRmKeyVault
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmKeyVault
[[-VaultName] <String>]
[[-ResourceGroupName] <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmKeyVault
[-VaultName] <String>
[-Location] <String>
[-InRemovedState]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmKeyVault
[-InRemovedState]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzureRmKeyVault cmdlet gets information about the key vaults in a subscription. You can view all key vaults instances in a subscription, or filter your results by a resource group or a particular key vault. Note that although specifying the resource group is optional for this cmdlet when you get a single key vault, you should do so for better performance.
Examples
Example 1: Get all key vaults in your current subscription
PS C:\> Get-AzureRMKeyVault
Vault Name : myvault1
Resource Group Name : myrg
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg/providers/Microsoft.Ke
yVault/vaults/myvault1
Tags :
Vault Name : myvault2
Resource Group Name : myrg1
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg1/providers/Microsoft.Ke
yVault/vaults/myvault2
Tags :
Vault Name : myvault3
Resource Group Name : myrg1
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg1/providers/Microsoft.Ke
yVault/vaults/myvault3
Tags :
This command gets all the key vaults in your current subscription.
Example 2: Get a specific key vault
PS C:\> Get-AzureRMKeyVault -VaultName 'myvault'
Vault Name : myvault
Resource Group Name : myrg
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg/providers
/Microsoft.KeyVault/vaults/myvault
Vault URI : https://myvault.vault.azure.net/
Tenant ID : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
SKU : Standard
Enabled For Deployment? : True
Enabled For Template Deployment? : True
Enabled For Disk Encryption? : False
Soft Delete Enabled? : True
Access Policies :
Tenant ID : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Object ID : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Application ID :
Display Name : User Name (username@microsoft.com)
Permissions to Keys : get, create, delete, list, update,
import, backup, restore, recover
Permissions to Secrets : get, list, set, delete, backup,
restore, recover
Permissions to Certificates : get, delete, list, create, import,
update, deleteissuers, getissuers, listissuers, managecontacts, manageissuers,
setissuers, recover
Permissions to (Key Vault Managed) Storage : delete, deletesas, get, getsas, list,
listsas, regeneratekey, set, setsas, update
Tags :
This command gets the key vault named myvault in your current subscription.
Example 3: Get key vaults in a resource group
PS C:\> Get-AzureRmKeyVault -ResourceGroupName 'myrg1'
Vault Name : myvault2
Resource Group Name : myrg1
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg1/providers/Microsoft.Ke
yVault/vaults/myvault2
Tags :
Vault Name : myvault3
Resource Group Name : myrg1
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg1/providers/Microsoft.Ke
yVault/vaults/myvault3
Tags :
This command gets all the key vaults in the resource group named ContosoPayRollResourceGroup.
Example 4: Get all deleted key vaults in your current subscription
PS C:\> Get-AzureRmKeyVault -InRemovedState
Vault Name : myvault4
Location : westus
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.KeyVault/locations/westu
s/deletedVaults/myvault4
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg/providers/Microsoft.K
eyVault/vaults/myvault4
Deletion Date : 5/24/2018 9:33:24 PM
Scheduled Purge Date : 8/22/2018 9:33:24 PM
Tags :
This command gets all the deleted key vaults in your current subscription.
Example 5: Get a deleted key vault
PS C:\> Get-AzureRMKeyVault -VaultName 'myvault4' -Location 'westus' -InRemovedState
Vault Name : myvault4
Location : westus
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.KeyVault/locations/westu
s/deletedVaults/myvault4
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg/providers/Microsoft.K
eyVault/vaults/myvault4
Deletion Date : 5/24/2018 9:33:24 PM
Scheduled Purge Date : 8/22/2018 9:33:24 PM
Tags :
This command gets the deleted key vault information named myvault4 in your current subscription and in westus region.
Parameters
-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 |
-InRemovedState
Specifies whether to show the previously deleted vaults in the output.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
The location of the deleted vault.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the resource group associated with the key vault or key vaults being queried.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Tag
Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VaultName
Specifies the name of the key vault.
Type: | String |
Aliases: | Name |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |