2017-01-10 9 views
0

Azure 실행 계정이 더 이상 모든 스크립트에서 작동하지 않는 것으로 보입니다. 우리는 변경하지 않았으며, cert는 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 로그를 생각했다. 조사한 다른 문제는 매개 변수의 값일 수 있습니다.

$RGName: my-rg

$Edition: Standard

$ServerName: my-db-server //이 아니라 완전한 하나지만 너무

$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