Get-AzRecoveryServicesVault
Gets a list of Recovery Services vaults.
Syntax
Get-AzRecoveryServicesVault
[[-ResourceGroupName] <String>]
[[-Name] <String>]
[-TagName <String>]
[-TagValue <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzRecoveryServicesVault
[[-ResourceGroupName] <String>]
[[-Name] <String>]
-Tag <Hashtable>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzRecoveryServicesVault cmdlet gets a list of Recovery Services vaults in the current subscription.
Examples
Example 1
Get-AzRecoveryServicesVault
Get the list of vault in selected subscription.
Example 2
Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup"
Get the list of vault in resource group in selected subscription.
Example 3: Get vault MSI, PublicNetworkAccess, ImmutabilityState, CrossSubscriptionRestoreState
$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$vault.Identity | Format-List
$vault.Properties.PublicNetworkAccess
$vault.Properties.ImmutabilitySettings.ImmutabilityState
$vault.Properties.RestoreSettings.CrossSubscriptionRestoreSettings.CrossSubscriptionRestoreState
PrincipalId : XXXXXXXX-XXXX-XXXX
TenantId : XXXXXXXX-XXXX-XXXX
Type : SystemAssigned
Enabled
Disabled
Enabled
The first cmdlet gets the vault in resource group with given name. Then we access the MSI information from the vault. Third and fourth commands are used to fetch the public network access, immutability state, cross subscription restore state of the vault.
Example 4: Get Encryption properties of the vault
$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$vault.Properties.EncryptionProperty.KeyVaultProperties
$vault.Properties.EncryptionProperty.KekIdentity
$vault.Properties.EncryptionProperty.InfrastructureEncryption
KeyUri
------
https://oss-pstest-keyvault.vault.azure.net/keys/cmk-pstest-key2
UseSystemAssignedIdentity UserAssignedIdentity
------------------------- --------------------
False /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/resourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/pstest-uami
Enabled
The first cmdlet gets the vault in resource group with given name. The second, third and fourth commands are used to fetch the encryption propties (KeyUri, KekIdentity and infrastructure encryption) of the vault for CMK.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Specifies the name of the vault to query for.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the Azure resource group from which to retrieve the specified Recovery Services object.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Tag
Specifies the Tags to query for
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TagName
Specifies the Key of the Tag to query for
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TagValue
Specifies the Value of the Tag to query for
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
Notes
Get-AzRecoveryServicesVault in old version of Az.RecoveryServices(<=2.10.0) cannot work with Az.Accounts(>=1.8.1) because of incorrect assembly reference. The module Az.RecoveryServices needs to be upgraded to 2.11.0 or newer if you are using the latest Az or Az.Accounts.
Related Links
Azure PowerShell