Get Azure Subscription, Tenant, Client ID, Client secret

To access Azure API, ARM, setting up an application or while using Fluent SDK you will need Subscription Id, Tenant Id, Client Id, and client secret. This blog explains to how get these details using Azure Portal and Azure CLI.

For creating Azure VM you need to have a valid Azure account. If you do not have it, you can create using Azure Portal for free.

Get Subscription ID

Azure subscription ID is a GUID that identifies your subscription and underlying services. Subscription has a trust relationship with Azure AD to authenticate users, services, devices, etc.

  1. Login to Azure Portal

  2. To get a list of all available Subscriptions you can search Subscription or click on Subscriptions from the Azure dashboard.

  3. You can copy the Subscription ID of a specific subscription as shown in the below picture.

    Get Azure Subscription id

  4. To Get subscription ID using Azure CLI use this command

    az account show --query id --output tsv
                

Get Tenant ID

Tenant Id is the unique identifier of the Azure Active Directory instance. One subscription can have multiple tenants. Using this Tenant Id you register and manage your apps.

  1. Login to Azure Portal
  2. Search for Azure Active Directory.
  3. If you have multiple tenants from the overview page click on Manage Tenants to get the Tenant Id of a specific tenant.

    If you need the Tenant Id of the default Tenant you can get it from the Overview page itself.

  4. You will see the list of Available Tenants for you. Copy the Organization ID to get Tenant ID. You can also click on the specific Active directory to see more tenant details.
  5. You can also click on the specific Active directory to see more tenant details.

    You will see Tenant details screen like this.

    Get Azure Tenant id

  6. To get tenant id using Azure CLI use below command

    az account tenant list
        

Create Azure Active Directory Application

  1. Login to Azure Portal if you are not already logged in.
  2. Search for Azure Active Directory
  3. From left Menu of Azure Directory Overview -> clickApp registrations -> Click + New Registration.
  4. Enter your application name. Optionally you can enter the Redirect URI to get Authentication response.
  5. Click on Register.

    Your application is created.

  6. To create an Azure AD application using Azure CLI, you can use the below command.

    az ad app create --display-name GeeksAPI --identifier-uris https://geeksapi.websites.net
                

Get Client / Application Id

Azure Client Id is Active Directory Application Id. Client Id is the unique identifier of an application created in Active Directory. You can have many applications in an Active Directory. Each application will have a different access level.

  1. Login to Azure Portal if you are not already logged in.
  2. Search for Azure Active Directory
  3. From left Menu of Azure Directory Overview -> click App registration
  4. click Owned Application tab -> Click the name of the application created in previous step, in my case name will be GeeksAPI.
  5. Copy Application Id

    Get Azure AD App Client id

Get Client Secret Id

  1. Login to Azure Portal if you are not already logged in.
  2. Search for Azure Active Directory
  3. From left Menu of Azure Directory -> click App Registration -> Click the name of the application created in the previous step, in my case name will be GeeksAPI.
  4. From the left menu of GeeksAPI (application) -> click Certificates & secrets
  5. Click on New Client Secret from right side pane -> Add description and expiration in Add a Client Secret screen -> Click Add button.
  6. Copy Value

    Get Azure AD App secret id

Speak your mind
Please login to post your comment!