使用Azure Runbooks中的Powershell将bacpac文件从blob存储还原到Azure SQL数据库

时间:2019-09-25 05:11:53

标签: azure powershell automation azure-sql-database

我试图运行以下PowerShell脚本将.bacpac文件还原到Azure SQL数据库,但出现错误:

  

对象引用未设置为对象的实例

如何修复Powershell脚本以使其在Azure Automation Runbook中运行?

$importRequest = New-AzureRmSqlDatabaseImport -ResourceGroupName "RG1" `
   -ServerName "sql001.database.windows.net" `
   -DatabaseName "WideWorldImportersDB" `
   -DatabaseMaxSizeBytes "50000" `
   -StorageKeyType "StorageAccessKey" `
   -StorageKey "key1" `
   -StorageUri "https://blob001.blob.core.windows.net/container/WideWorldImporters-Standard.bacpac" `
   -Edition "Standard" `
   -ServiceObjectiveName "P6" `
   -AdministratorLogin "login" `
   -AdministratorLoginPassword $(ConvertTo-SecureString -String "123!" -AsPlainText -Force)

0 个答案:

没有答案