title: How do I authenticate to Azure using a Service Principal and the Python SDK?
body: <p>I am currently attempting to authenticate to Azure using the <a href="https://docs.microsoft.com/en-us/python/api/azure-mgmt-support/azure.mgmt.support.microsoftsupport?view=azure-python" rel="nofollow noreferrer"><code>azure-mgmt-support</code></a> MicrosoftSupport client and am receiving the following error:</p>
  
  <pre><code>AdalError: Get Token request returned http error: 400 and server response: {"error":"unauthorized_client","error_description":"AADSTS700016: Application with identifier 'xxx' was not found in the directory 'management.core.windows.net'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.
  </code></pre>
  
  <p>I have double checked and am definitely using the correct <code>client_id</code> and <code>tenant_id</code>. What am I missing here? My code below:</p>
  
  <pre><code>from azure.mgmt.support import MicrosoftSupport
  from msrestazure.azure_active_directory import ServicePrincipalCredentials 
  
  sub_id = 'xxx'
  sp_creds = ServicePrincipalCredentials(client_id='xxx', secret='xxx')
  
  SupportClient = MicrosoftSupport(sp_creds, sub_id)
  </code></pre>