16
votes

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.

1

1 Answers

10
votes

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/