我试图运行以下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)