Get-AzRecoveryServicesVault
Gets a list of Recovery Services vaults.
Syntax
ByTagNameValueParameterSet
Get-AzRecoveryServicesVault
[[-ResourceGroupName] <String>]
[[-Name] <String>]
[-TagName <String>]
[-TagValue <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ByTagObjectParameterSet
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 properties (KeyUri, KekIdentity and infrastructure encryption) of the vault for CMK.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Name
Specifies the name of the vault to query for.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 2 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ResourceGroupName
Specifies the name of the Azure resource group from which to retrieve the specified Recovery Services object.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 1 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Tag
Specifies the Tags to query for
Parameter properties
Type: | Hashtable |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByTagObjectParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-TagName
Specifies the Key of the Tag to query for
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByTagNameValueParameterSet
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-TagValue
Specifies the Value of the Tag to query for
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByTagNameValueParameterSet
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
None
Outputs
ARSVault
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.