我正在尝试使用以下电源shell脚本通过服务主体身份验证来检查DataLake Analytics帐户状态是否处于活动状态 . 应用程序可以访问datalake分析帐户 . 它存在于我的订阅中的一个资源组中 . 当我尝试运行以下命令时,我收到的错误是分析帐户不存在于任何资源组中 . 但我只看到了一些错误,但并非总是如此 . 我不认为这种行为是由于网络问题,因为脚本运行得很早 .

注意:在现有DataLakeStore和Google Analytics帐户成为Gen1后,我看到此错误 . 有人可以帮助我为什么会收到此错误?

System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials;
Login-AzureRmAccount -ServicePrincipal -TenantId 'Tenant'  -ApplicationId 'ApplicationID' -CertificateThumbprint  'Certificate' -ErrorAction Stop > $null ; 
$Status = Get-AzureRmDataLakeAnalyticsAccount -Name 'ADLAccount'
-ErrorAction Stop -ErrorVariable ErrorStatus;
if($Status.State -ne 'Active'){
Write-Error ('Error Occurred while connecting to DataLake analytics account::ADLAAccount');}
}
Catch{
Write-Error ($_.Exception.Message +';'+ $_.InvocationInfo.PositionMessage);
}

无法在当前所选订阅中的任何资源组中找到帐户:“ADLAAccount”:subscriprionID . 请确保此帐户存在并且当前用户可以访问它 . 在“AppID” - CertificateThumbprint“Thumbprint” - ErrorAction Stop> $ null;