首页 > 解决方案 > 使用 powershell 将 bacpac 导出到 Azure 存储帐户

问题描述

我正在尝试创建一个 powershell 脚本来将 Azure 上的 SQL 数据库备份到存储帐户,如下所示,

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

这是我正在关注的文件,

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

我假设以下,

$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

请告知此处需要传递哪些参数。

标签: powershellazure-devopsazure-sql-database

解决方案


请告知此处需要传递哪些参数。

  • StorageKey:指定存储帐户的访问密钥。

  • StorageKeyType:指定存储帐户的访问密钥类型。

    此参数的可接受值为:

    StorageAccessKey. 此值使用存储帐户密钥。

    SharedAccessKey. 此值使用共享访问签名 (SAS) 密钥。

有关更多详细信息,请参阅此链接


推荐阅读