5

I am trying to check whether the DataLake Analytics account State is active or not with the below power shell script through Service Principal authentication. Application is given the access to datalake analytics account. And it is present in one of the resource groups in my subscription. When I am trying to run the below command, I am getting the error that analytics account is not present in any resource group.But I am seeing this error only some times but not always. I dont think this behavior is due to network issues as script was running fine earlier.

Note: I am seeing this error after the existing DataLakeStore and Analytics accounts have become Gen1. Can some one help me why I am getting this error?

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);
}

Could not find account: 'ADLAAccount' in any resource group in the currently selected subscription: subscriprionID. Please ensure this account exists and that the current user has access to it.;At 'AppID' - CertificateThumbprint 'Thumbprint' -ErrorAction Stop > $null ;

Hadi
  • 36,233
  • 13
  • 65
  • 124
ravi kiran
  • 371
  • 1
  • 5
  • 17
  • The error says an account is missing. Have you checked to make sure that it exists with the target application? – J Weezy Jul 11 '18 at 16:37
  • @J Weezy It exists in the target applications. I am sure about it as the script was runnuning fine previously. Kind of this error I am seeing only some times not always. Run time is unable to connect to analytics engine – ravi kiran Jul 11 '18 at 18:32
  • Intermittent runs sounds like a network issue. Is this the only application that is having intermittent runs? – J Weezy Jul 11 '18 at 19:27
  • Yes. It is only happening with ADLA accounts. I have various analytics accounts created for development, QA and production. All resulting the same issue. Script is simple and I am just trying to know the status of Analytics account. If it was the network issue there should have been clear error information. – ravi kiran Jul 11 '18 at 19:53
  • Unfortunately, I do not have any experience working with Azure Data Lake via PowerShell. My best recommendation is to check the online resources provided by Microsoft and step through the code in order to identify the problem. https://learn.microsoft.com/en-us/azure/data-lake-analytics/data-lake-analytics-manage-use-powershell – J Weezy Jul 12 '18 at 00:03
  • I have gone through the documentation but didn't get any clue on the issue – ravi kiran Jul 12 '18 at 07:51
  • can some one help me on this? – ravi kiran Jul 17 '18 at 12:27
  • Do you have multiple subscriptions? – shoover Jul 18 '18 at 16:07
  • Yes there are two subscriptions. But the script is pointing to the correct subscription where the analytics account is present. Do I need to mention the subscription explicitly here. I dont think so – ravi kiran Jul 20 '18 at 11:39

0 Answers0