Aryan M
Aryan M

Reputation: 657

Export bacpac to a Azure storage account using powershell

I'm trying to create a powershell script to backup a SQL database on Azure to a storage account as below,

$exportRequest = New-AzureRmSqlDatabaseExport -ResourceGroupName 
$ResourceGroupName -ServerName $ServerName `
-DatabaseName $DatabaseName -StorageKeytype $StorageKeytype -StorageKey 
$StorageKey -StorageUri $BacpacUri `
-AdministratorLogin $creds.UserName -AdministratorLoginPassword $creds.Password

This is the document i'm following,

https://learn.microsoft.com/en-us/azure/sql-database/sql-database-export

I assume the following,

$ResourceGroupName - my azure resource group
$ServerName - db server name
$DatabaseName - database name
**$StorageKeytype - NOT SURE WHAT VALUE SHOULD BE PLACED HERE**
**$StorageKey - I'm hoping this is one of the access keys under the azure storage account**
$BacpacUri - Azure storage account bacpac URI path

Please advice what parameters need to passed here.

Upvotes: 0

Views: 633

Answers (1)

Joy Wang
Joy Wang

Reputation: 42063

Please advice what parameters need to passed here.

  • StorageKey : Specifies the access key for the storage account.

  • StorageKeyType: Specifies the type of access key for the storage account.

    The acceptable values for this parameter are:

    StorageAccessKey. This value uses a storage account key.

    SharedAccessKey. This value uses a Shared Access Signature (SAS) key.

For more details, refer to this link.

Upvotes: 1

Related Questions