0

我只是看着一些「AzureRMSQL」powershell命令來管理數據庫和數據庫服務器。這份名單是在這裏....Azure資源管理器SQL數據庫 - 沒有PowerShell導出?

https://msdn.microsoft.com/library/azure/mt574084.aspx

似乎沒有成爲一個導出命令。我錯過了什麼嗎?該功能在新的門戶網站中,因此應該有可能。

對於非資源管理器SQL數據庫,有命令「Start-AzureSqlDatabaseExport」,但我不認爲這適用於RM數據庫。

感謝 威爾

回答

0

起初刷這可能是一個有點混亂,簡單地通過沒有適當的cmdlet的。但是,SQL服務器的工作方式與存儲工作方式類似。一旦您擁有身份驗證上下文,ASM和ARM部署都將使用ASM cmdlet。

在這種情況下,你會做這樣的事情

$cred = Get-Credential # sql authentication 
$context = New-AzureSqlDatabaseServerContext ` 
           -ServerName temp01confuseiosql ` 
           -Credential $cred 

$storagecontext = (Get-AzureRmStorageAccount ` 
         -ResourceGroupName testrg ` 
         -Name teststore01).Context 


Start-AzureSqlDatabaseExport -SqlConnectionContext $context ` 
         -StorageContext $storagecontext ` 
         -StorageContainerName sql ` 
         -DatabaseName testdb ` 
         -BlobName $blobname 
+0

對不起,延遲迴到此。感謝你的回答。我將構建一些SQL數據庫並檢查其工作原理。 – Will

+0

有沒有人得到這個工作?我使用這種方法與舊的經典數據庫,但它對我的新的RM數據庫失敗。 –

1

我試過很多次用下面的命令:

$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。