我想創建一個Azure SQL數據庫連接上下文例如創建Azure SQL數據庫服務器連接上下文新AzureSqlDatabaseServerContext
$cred = Get-Credential
$ctx = New-AzureSqlDatabaseServerContext -ServerName 「mydatabasename」 -credential $cred
或
$pwd = ConvertTo-SecureString "[password1234]" -AsPlainText -Force;
$cred1 = New-Object System.Management.Automation.PSCredential -ArgumentList "databaseadmin", $pwd
New-AzureSqlDatabaseServerContext -ServerName "myservername" -Credential $cred1
和響應是:
New-AzureSqlDatabaseServerContext : Object reference not set to an instance of an object.
At line:2 char:8
+ $ctx = New-AzureSqlDatabaseServerContext -ServerName 「myservername」 - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureSqlDatabaseServerContext], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.SqlDatabase.Database.Cmdlet.NewAzureSqlDatabaseServerContext
我經歷過的文檔和谷歌搜索,但無濟於事。 https://msdn.microsoft.com/en-us/library/dn546736.aspx http://sqlmag.com/powershell/manage-azure-sql-databases-powershell
感謝 帕維爾
什麼是您正在使用的Microsoft Azure PowerShell版本? – juvchan
這是否始終如一地重現? – juvchan
是的,始終如一地轉載。 版本:1.0.3 名稱:Azure 作者:Microsoft Corporation PowerShellVersion:3.0 – Jack0fshad0ws