List details of Azure Management Group from daemon application - azure

I have a daemon application that wants to list all subscriptions (incl. some details) within a management group in Azure.
For that I have created an App registration including client secrets in Azure to be used by the daemon application.
However, I am having now problems granting access to an entire management group.
What has worked, was to create a Role assignment (Type App -> Role Reader) for a single subscription. However, this does not work on management group level. There, I can only assign roles of type User to some roles. I cannot assign an App to a role.
How can I grant now the daemon application reader access to the entire management group?
(assigning individual subscriptions is not an option, because I want to see with that application for example if a subscription has been added)

You could follow the steps below.
1.Navigate to the Azure portal -> search for management -> click Management groups.
2.Choose the management group you want.
3.Click (details).
4.Add the app(service principal) like below, in Select, search for your app name.

Related

My VSTS Service Connection needs to be allowed to add a reply url to an azure ad application

We are using VSTS/Azure DevOps to build and deploy our web services to Azure.
In the release step we use the Azure CLI build task to set up the environment for the web service. The build task uses a Service Connection to be authorized to do these actions.
The build task can create web services and deployment slots without issue, but when I try to instruct it to add a new reply url to the Azure AD application the web app uses to authenticate users, i see the following:
az ad app update --id 3e5a96e9-7311-4f92-869b-fbb5bbe8e41f --reply-urls http://mytestapp.azurewebsites.net
ERROR: Insufficient privileges to complete the operation.
The service connection used is an Azure RM service connection using a Service Principal. Is this correct? I'm guessing there is there a permission I need to set on the service principal, but which one?
Jayendran is correct. The user must be a member of Global Admin role in the directory because the Reply URL is added in the app registration.
You may also need to grant permissions to the app itself.
https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-v1-integrate-apps-with-azure-ad
If you're looking to follow the least privileges principle and not assign the highest possible privilege available (as per your comment), I see 3 possible options that could work for you -
Owner for only a specific application (and NOT the Owner/Global Administrator for entire Azure AD)
You can add the user as Owner for only the specific application, which they need to manage (in your case, change reply URL's for).
Pro: Obviously the good thing about this approach is that this user gets to manage the app registration for only this particular application and none of the others in your Azure AD.
How: Go to "App Registrations" in Azure AD and navigate to the specific application. Now click on "Settings" and select "Owners"
Application Administrator Role
This one is a little more generic and a higher privilege in comparison to single application owner, as it gives the user access to manage application registrations for all applications.
Pro: Role is specific to only managing application registrations. It helps in a scenario where all applications need to be managed by this user.
How: Go to "Users" in your Azure AD and then select the specific user. Now go to "Directory Role" and add "Application Administrator Role"
Application Developer Role
This one is very similar to option 2 i.e. "Application administrator". Difference being that "Application developer" gets permissions for only those applications which they are developing, so the registration was done by them.
Pro: Good for user that is about to create and manage registrations for multiple applications.
How: Very similar to option 2 above.
More information about all the available roles and granular permissions that are used by these roles in Microsoft Docs:
Available Roles

How to grant subscription access to an azure registered application?

I am trying to set up octopus to deploy resources to azure.
Under azure active directory I've added a new app registration, and have generated a key and hooked up octopus with the correct Application ID, Tenant ID and key
The organisation has multiple azure subscriptions corresponding to the environments, so I've noticed if I use the Subscription ID of my "Visual Studio Professional MSDN" subscription it works and creates the resources, however if I try to use any of the other organisation Subscription IDs I get the following error:
Login-AzureRmAccount : The provided account c0b2.......76a6 does not
have access to subscription ID "f06.......2aa3". Please try logging in
with different credentials or a different subscription ID.
I have looked through all the settings of the Application Registration and granted it every "Windows Azure Active Directory" permission available, but still no luck.
How do I go about granting permissions to this Application Registration so that it can access the relevant subscriptions?
You need to give the app a role on the subscription/resource group/resource you want it to be able to access.
So for example, you can go to the Access Control (IAM) tab of the subscription, and give the app the Contributor role, which allows the app to read and modify anything in the subscription.
You can also give a more limited role if desired.
Roles can also be applied at a lower scope, like a resource group.
More info in the docs: https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal

How to lock an Azure web app down to a specific group of users

This should really be a basic question, but I can't find the answer anywhere.
I've got a website that I'm hosting as an Azure Web App. I've created an App Registration and I've associated the Web App with the App. Now, I'm prompted to log on before being allowed to view the web site. So far so good, but I want to lock it down so that only a specific group of users has access to the site.
I go to Enterprise Applications and I give permission the application to certain users/groups. But I can still log into the website as any user in the tenancy.
How do I ensure that only a certain group of users can log into the website?
It looks like you've discovered how to assign users and groups to the app (under Enterprise apps, in the Azure portal). These assignments are called "app role assignments". As you've also noticed, by default, app role assignment is not required in order for users to be able to sign in. However, there is a configuration which you can use to require an app role assignment.
In the Azure portal, under Azure Active Directory > Enterprise apps > (choose your app) > Properties:
(Note: Sometimes it takes a few seconds for this option to appear, when you load the Properties blade.)
And if you want to do the same thing with Azure AD PowerShell, you could do something like this:
$appId = "{the app ID}"
$servicePrincipal = Get-AzureADServicePrincipal -Filter "appId eq '$appId'"
Set-AzureADServicePrincipal -ObjectId $servicePrincipal.ObjectId `
-AppRoleAssignmentRequired $true
Azure Websites integrates with the Role-Based Access Control (RBAC) feature. Enabling RBAC gives you greater control over whom you allow access to your resources and what level of access each person has.
Goto your app -> Access Control (IAM) -> assign roles.
Owner - Has full admin access to the site and can perform all operations.
Contributor – Can deploy code, start/stop the site, swap deployments, delete the site, etc. Cannot change pricing plan or perform some other admin functions.
Reader – Can view the website in the portal, but cannot make any changes to it.
For more details, refer Managing User Access to Specific Sites in the Azure Portal and Use Role-Based Access Control to manage access to your Azure subscription resources.
Hope this helps.

How to allow self service role selection for Azure/Office365 application assignment

In Microsoft Azure, I can add an application from the marketplace to my Active Directory. For example let's say 'Salesforce'.
I can enable SSO and Provisioning and particularly Self Service.
The steps to setup self service are here:
https://learn.microsoft.com/en-us/azure/active-directory/active-directory-self-service-application-access
Those steps are for the old portal, but I used the new portal, it's mostly the same.
Some applications, like Salesforce, have multiple roles that can be assigned, and when you add a user or group an assignment you select a role. As far as I can tell, you can only enable self service features to put a user directly into a single specific group, and that group dictates the role that is assigned.
My question is:
Is there a way to allow the end user, when requesting an application, to pick the role they want? Even if it is a bit round-about, like picking a group that assigns the role. Or is azure self-service limited to granting access to one specific role?

How I can select a specific AD in IAM menu

When I select an IAM menu (Identity + Acces Management) I see a list of user accounts extracted from my Azure AD
But I have several AD.From what criteria Azure select an AD rather another one?
Hi assuming your question is that you have multiple Azure Active Directories, rather than multiple on-prem ADs that you need to sync - then via the preview management blades in the new portal can you change which Direcotry they list via the icon on the top right which shows your logged in user. From there simply select the Directory you wish to manage.
It is only able to grant the access to the users in the Azure Active Directory which the Azure subscription trust. It is not able to switch the Azure Active Directory to grant the access.
Each Azure subscription is associated with one Azure Active Directory (AD) directory. Users, groups, and applications from that directory can manage resources in the Azure subscription. Assign these access rights using the Azure portal, Azure command-line tools, and Azure Management APIs.
Grant access by assigning the appropriate RBAC role to users, groups, and applications at a certain scope. The scope of a role assignment can be a subscription, a resource group, or a single resource. A role assigned at a parent scope also grants access to the children contained within it. For example, a user with access to a resource group can manage all the resources it contains, like websites, virtual machines, and subnets.
The RBAC role that you assign dictates what resources the user, group, or application can manage within that scope.
Here are some helpful articles about Role-based access control and Azure subscription:
How Azure subscriptions are associated with Azure Active Directory
Get started with access management in the Azure portal
Use role assignments to manage access to your Azure subscription resources

Resources