title: Select-AzureRmSubscription : Please provide a valid tenant or a valid subscription
body: <p>I have created the Powershell Runbook, and added all the required details and valid values. Still I am facing the error for <code>Select-AzureRmSubscription</code> command. The error I am getting all the time is </p>
  
  <blockquote>
    <p>Select-AzureRmSubscription : Please provide a valid tenant or a valid subscription.</p>
  </blockquote>
  
  <p>I am using below connection setting in Powershell runbook:</p>
  
  <pre><code>$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
      }
  }
  
  
  fetch-group-memberships | Select-Object UserName, PrincipalName, GroupName, AzureGroupName |Sort-Object GroupName| Export-Csv -NoTypeInformation -Path
  'MEMBERSHIP.csv' 
  
  #=======================================================================================
  
  # Select the subscription you are going to work with
  
  #=======================================================================================
  Select-AzureRmSubscription -SubscriptionId
  "[removed for security purpose]"
  
  #Get-AzureRmSubscription -SubscriptionName "BIG" | Select-AzureRmSubscription
  
  #=======================================================================================
  
  # Set the Current Storage Account to the approperiate location
  
  #=======================================================================================
  
  Set-AzureRmCurrentStorageAccount -StorageAccountName devapacbi01 -ResourceGroupName dev-rgp-apac-01
  
  #=======================================================================================
  
  # Capture the file that is local to automation and save to Storage Blob
  
  #=======================================================================================
  
  Set-AzureStorageBlobContent -Container bi-app-carm-im -File ADGROUP_MEMBERSHIP.csv -Blob _MEMBERSHIP_AL.csv -Force
  </code></pre>
  
  <p>Even if the subscription id is correct it keeps throwing an error as above.</p>