2017-01-10 22 views
0

Azure Run Asアカウントはどのスクリプトでも動作していないようです。私たちはそれに変更を加えませんでした。証明書は2018年に失効します。これが原因だと思われますが、解決策はありません。Set-AzureRmSqlDatabaseが失敗しています

トラブル、それがこのエラーを生成ようSet-AzureRmSqlDatabase -ResourceGroupName "$RGName" -DatabaseName "$DBName" -ServerName "$ServerName" -Edition $Edition -ServiceObjective $DBLevelを実行しているを持つ:

Set-AzureRmSqlDatabase : Run Login-AzureRmAccount to login. 
At line:56 char:1 
+ Set-AzureRmSqlDatabase -ResourceGroupName "$RGName" -DatabaseName "$D ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidOperation: (:) [Set-AzureRmSqlDatabase], PSInvalidOperationException 
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.Sql.Database.Cmdlet.SetAzureSqlDatabase 

私はセッションでAdd-AzureRmAccountログを考えました。調査したもう1つの問題は、パラメータの値になる可能性があります。

$RGName: my-rg

$Edition: Standard

$ServerName: my-db-server //ない完全修飾1が、私はあまりにも

$DBName: my-db

$DBLevel: S0

同じ上部の作品、それを試してみました:サンプル値は、別のスクリプトでうまくいくアプリケーションプランのサイズを変更します。

コード:あなたは紺碧にサインインしていない

Param 
    (
     [Parameter (Mandatory= $true)] 
     [String] $RGName, 

     [Parameter (Mandatory= $false)] 
     [String] $Edition="Standard", 

     [Parameter (Mandatory= $true)] 
     [String] $ServerName, 

     [Parameter (Mandatory= $true)] 
     [String] $DBName, 

     [Parameter (Mandatory= $true)] 
     [String] $DBLevel, 

     [Parameter (Mandatory= $false)] 
     [String] $SubId = "mysub" 
    ) 
$connectionName = "AzureRunAsConnection" 

try 
{ 
    # Get the connection "AzureRunAsConnection " 
    $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName   

    "Logging in to Azure..." 
    Add-AzureRmAccount ` 
     -ServicePrincipal ` 
     -TenantId $servicePrincipalConnection.TenantId ` 
     -ApplicationId $servicePrincipalConnection.ApplicationId ` 
     -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint 
} 
catch { 
    if (!$servicePrincipalConnection) 
    { 
     $ErrorMessage = "Connection $connectionName not found." 
     throw $ErrorMessage 
    } else{ 
     Write-Error -Message $_.Exception 
     throw $_.Exception 
    } 
} 

Select-AzureRmSubscription -SubscriptionId $SubId 

Set-AzureRmSqlDatabase -ResourceGroupName "$RGName" -DatabaseName "$DBName" -ServerName "$ServerName" -Edition $Edition -RequestedServiceObjectiveName $DBLevel 

答えて

0

Set-AzureRmSqlDatabase : Run Login-AzureRmAccount to login 

ログオンし、再試行してください。

Add-AzureRmAccountが失敗したようです。 try catchを削除し、戻り値を見てください。

+0

さて、2018年にアカウント証明書の有効期限が切れていることを確認しました。これまで実行していたスクリプトは、このログインに基づいて失敗しており、対処方法がわかりません。 – lucuma

+0

私はこれを変更せずに動作します。私はあなたに答えのクレジットを与えます。私はサポートチケットを提出し、彼らが何を言っているかを見るでしょう。 – lucuma

関連する問題