title: Using Azure KeyVault, cannot find object in Azure Active Directory tenant
body: <p>Using Azure KeyVault I have set up a ResourceGroup, KeyVault and Key by following this guide: </p>
  
  <p><a href="https://azure.microsoft.com/en-gb/documentation/articles/key-vault-get-started/" rel="nofollow noreferrer">https://azure.microsoft.com/en-gb/documentation/articles/key-vault-get-started/</a></p>
  
  <p>I have set up the application client in Active Directory. However when I try to use:</p>
  
  <pre><code>Set-AzureKeyVaultAccessPolicy
  </code></pre>
  
  <p>I get the following error when granting permissions to the <strong>Service Principal</strong> account:</p>
  
  <p>"Cannot find the Active Directory object '<em>clientId</em>' in tenant '<em>tenantId</em>'. Please make sure that the user of application service principal you are authorizing is registered in the current subscription's Azure Active directory."</p>
  
  <p>The clientId is correct as this was copied from the application configuration page in the portal. The tenant Id is the tenant ID for the current subscription.. but not for the active directory.</p>
  
  <p>The problem seems to be that the tenant ID for the Active Directory is different to the tenant ID for the subscription I'm using. How do I change the tenant ID of my Active Directory in the Azure Portal to match the subscription tenant ID?</p>