我試過很多次用下面的命令:
$Credential = Get-Credential
$SqlContext = New-AzureSqlDatabaseServerContext -ServerName $ServerName -Credentials $Credential
$StorageContext = New-AzureStorageContext -StorageAccountName $StorageName -StorageAccountKey $StorageKey
$Container = Get-AzureStorageContainer -Name $ContainerName -Context $StorageContext
$exportRequest = Start-AzureSqlDatabaseExport -SqlConnectionContext $SqlContext -StorageContainer $Container -DatabaseName $DatabaseName -BlobName $BlobName
但是,當創建了New-AzureSqlDatabaseServerContext
服務器連接方面,有消息稱該服務器未找到或無法訪問:
New-AzureSqlDatabaseServerContext : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that S
QL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
At line:1 char:8
+ $Con = New-AzureSqlDatabaseServerContext -ServerName "derekserver" -C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureSqlDatabaseServerContext], SqlException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet.NewAzureSqlDatabaseServerContext
所以基本上我們可以推測New-AzureSqlDatabaseServerContext
不適用於Azure資源管理器SQL數據庫。
現在沒有發現具有相同功能的ARM cmdlet。
對不起,延遲迴到此。感謝你的回答。我將構建一些SQL數據庫並檢查其工作原理。 – Will
有沒有人得到這個工作?我使用這種方法與舊的經典數據庫,但它對我的新的RM數據庫失敗。 –