I need to understand whether there is a way to fetch clientid, clientsecret and tenantid via azure rest api or is there any other method which can be automated?

ANIRUDH TPVS 1 Reputation point
2020-11-19T07:43:15.533+00:00

I actually need some help in fetching the some details like the SubscriptionID, ClientID, ClientSecret, tenantId from the azure cloud shell. I need some help with regards to this.

I am able to fetch the details from the azure cloud shell manually.

But I need to understand whether there is a way to fetch these details via azure rest api or any other method which can be automated?

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
668 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JessicaH-MSFT 246 Reputation points Microsoft Employee
    2020-11-19T19:50:30.31+00:00

    I'm not sure how you're wanting to use the details you're attempting to fetch but I'm assuming you want to have an application that can access or modify resources. For security reasons, it is always recommended to use Service Principals with automated tools rather than allowing them to log in with a user identity. So I would recommend that you start by creating a service principal identity to handle that.

    This article shows you how to create a new Azure Active Directory (Azure AD) application and service principal that can be used with the role-based access control:
    https://video2.skills-academy.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal