< Back

New-AzureStorageKey

Wed Jan 30, 2019 5:49 pm

NAME New-AzureStorageKey



SYNOPSIS

Regenerates storage keys for an Azure storage account.





SYNTAX

New-AzureStorageKey [-KeyType] <String> [-StorageAccountName] <String> [-Profile <AzureSMProfile>] [-InformationAction <ActionPreference>]

[-InformationVariable <String>] [<CommonParameters>]





DESCRIPTION

The New-AzureStorageKey cmdlet regenerates the primary or secondary key for an Azure Storage account. It returns an object that contains the storage

account name, primary key, and secondary key as properties.





PARAMETERS

-KeyType <String>

Specifies which key to regenerate. Valid values are: Primary and Secondary.



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-StorageAccountName <String>

Specifies the name of the Azure Storage account for which to regenerate a key.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Profile <AzureSMProfile>

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationAction <ActionPreference>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationVariable <String>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

StorageServiceKeys







NOTES









-------------------------- Example 1: Regenerate a primary storage key --------------------------



PS C:\\>New-AzureStorageKey -KeyType "Primary" -StorageAccountName "ContosoStore01"



This command regenerates the primary storage key for the ContosoStore01 storage account.

-------------------------- Example 2: Regenerate a secondary storage key and save it in a variable --------------------------



PS C:\\>$ContosoStoreKey = New-AzureStorageKey -KeyType "Secondary" -StorageAccountName "ContosoStore01"



This command regenerate the secondary storage key for the ContosoStore01 storage account and stores the updated storage account key information in the

$ContosoStoreKey.



RELATED LINKS

Get-AzureStorageKey