Norrin Rad
Norrin Rad

Reputation: 991

Get AzureRMStorage Replication Setting

We are trying to get a script to check current storage replication settings(LRS,GAGRS,GRS) and we can't seem to find anything on google.

Even in the proerties below we don't get a heading for "replication" (unless I'm missing something)

Is there a way to get the setting and ultimately if it wrong is there a way to amend it?

We would like them all set to LRS, some are set to GRS that we have found.

Login-AzurermAccount
Select-AzureRmSubscription -SubscriptionId xxxxx-xxxxx-xxxxx-xxxxx
Get-AzureRmStorageAccount -ResourceGroupName rg-name -Name storageaccountname

ResourceGroupName      : rg-name
StorageAccountName     : storageaccountname
Id                     : /subscriptions/xxxxx-xxxxx-xxxxx-xxxxx/resourceGroups/rg-name/providers/Microsoft.Sto
                         rage/storageAccounts/storageaccountname
Location               : westeurope
Sku                    : Microsoft.Azure.Management.Storage.Models.Sku
Kind                   : Storage
Encryption             : 
AccessTier             : 
CreationTime           : 23/03/2017 16:54:28
CustomDomain           : 
Identity               : 
LastGeoFailoverTime    : 
PrimaryEndpoints       : Microsoft.Azure.Management.Storage.Models.Endpoints
PrimaryLocation        : westeurope
ProvisioningState      : Succeeded
SecondaryEndpoints     : 
SecondaryLocation      : 
StatusOfPrimary        : Available
StatusOfSecondary      : 
Tags                   : {[TAGS]}
EnableHttpsTrafficOnly : False
Context                : Microsoft.WindowsAzure.Commands.Common.Storage.LazyAzureStorageContext
ExtendedProperties     : {}

Thanks for your help :)

Upvotes: 0

Views: 203

Answers (1)

Shui shengbao
Shui shengbao

Reputation: 19195

You could use Get-AzureRmStorageAccount to list replication information. Like below:

$storage=Get-AzureRmStorageAccount -Name "shuiwindiag907" -ResourceGroupName "shuiwin"

$storage.Sku

You will get the following result.

PS C:\Users\v-shshui> $storage.Sku

       Name     Tier
       ----     ----
StandardLRS Standard

If you want to change replication, you could use Set-AzureRmStorageAccount. For example:

Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -Type "Standard_RAGRS"

Upvotes: 1

Related Questions