19

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.

2 Answers 2

11

Have you created a service principal in AD? If so, you should have these values. If you haven't, follow the msft guide.

https://azure.microsoft.com/en-gb/documentation/articles/resource-group-create-service-principal-portal/

4
  • Thanks, got my clientid etc working, still cant manage to add the application as 'a user' to my azure portal though... Commented Jun 13, 2016 at 10:10
  • The 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. Commented Jun 13, 2016 at 10:19
  • nevermind, I was working in the wrong AD directory. Gonna try again. Commented Jun 13, 2016 at 11:19
  • @EdwardRixon Here is the way to do it from the portal, I found it easier than running the powershell commands: learn.microsoft.com/en-us/azure/azure-resource-manager/… - maybe you can add it to your response. Commented Apr 2, 2017 at 19:58
1
  1. Azure portal
  2. Active Directory
  3. App registrations (on the right panel)
  4. Click the correct Application (client) ID
  5. You will see then under overview.

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.