Search code examples
azurejobs

Azure role/resourcfe group based security and CloudServiceManagementClient


We are looking at using Azure Jobs for out multi-tenant platform, but want to figure the best way to do security for it, without using a certificate that has access to our whole Azure account.

We have a Resource Group called "Scheduler" and for each tenant we create a Job Collection with the Tentants Id "Tenant{tenant.Id}".

Currently we do this using SchedulerManagementClient and passing in CertificateCloudCredentials. We could use the Token to do this, but I believe it still has the same problem - in that the credentials have access to the full azure account, which we don't want.

Ideally we would like to lock down creation to the resource group "Scheduler" and create a certificate/token for this.

Is there a way to do that? Is there a better way to do what we are doing anyway?


Solution

  • Ok I figured this out, as is always the way it seems when you finally post something on StackOverflow. Everything was complicated by the fact I was using the old management libraries (Microsoft.WindowsAzure.Management) and not the new libraries (Microsoft.Azure.Management).

    Basically I needed to create an application, and then assign that application roles just like you do users. This also helped: https://azure.microsoft.com/en-gb/documentation/articles/resource-group-create-service-principal-portal/