How to get clientId and clientsecret for Azure (ARM) deployment template
47,874
Have you created a service principal in AD? If so, you should have these values. If you haven't, follow the msft guide.
Author by
user2713516
Updated on July 09, 2022Comments
-
user2713516 almost 2 years
I want to automate my Azure resource management, and I'm using the ARM templates to do so.
If I want to connect to Azure from my C# code (the DeploymentHelper.cs that is generated when downloading an Azure export template).
The code is asking for the following details:
string subscriptionId = "your-subscription-id"; string clientId = "your-service-principal-clientId"; string clientSecret = "your-service-principal-client-secret"; string resourceGroupName = "resource-group-name"; string deploymentName = "deployment-name"; string resourceGroupLocation = "resource-group-location"; // must be specified for creating a new resource group string pathToTemplateFile = "path-to-template.json-on-disk"; string pathToParameterFile = "path-to-parameters.json-on-disk"; string tenantId = "tenant-id";
I can see the tentantId and subscriptionId via powershell, but I have no clue how to get the clientId and clientsecret, and I cant find any solid instructions on how to get these either.
-
user2713516 almost 8 yearsThanks, got my clientid etc working, still cant manage to add the application as 'a user' to my azure portal though...
-
user2713516 almost 8 yearsThe application just doesn't show up in the list of 'users' when doing Add users. I checked that I'm working in the same subscription.
-
user2713516 almost 8 yearsnevermind, I was working in the wrong AD directory. Gonna try again.
-
Liviu Costea about 7 years@EdwardRixon Here is the way to do it from the portal, I found it easier than running the powershell commands: docs.microsoft.com/en-us/azure/azure-resource-manager/… - maybe you can add it to your response.