How to create custom Azure AD roles - azure

I believe all Azure AD build in roles are here and here.
How can I create a 'custom role' from "Application Developer" Azure AD role? so that, 'person/group/service principle' having this custom role can only create other service principles. That is, having only "Create service principals" permission.
Also, considering this is Azure AD role, I would like to know: The person/group/service principle having this role, can they have access to the whole tenant level? Can this somehow restricted to a particular subscription level?
Please suggest. Thanks.

Related

Can a service principal create other service principals in Azure?

I found a link here which says:
There is no way to directly create a service principal using the Azure portal. When you register an application through the Azure portal, an application object and service principal are automatically created in your home directory or tenant.
My question is, Can a 'service principal' create another 'service principals' in Azure? If yes, how? and what all permissions required for this?
Please suggest. Thanks.
A service principal can create another service principal after being assigned either the corresponding MS Graph permission, or Azure AD role
MS Graph Permissions
Either of the permissions
Application.ReadWrite.All
Application.ReadWrite.OwnedBy
References
Microsoft Graph permissions reference
Create application API endpoint
Create servicePrincipal API endpoint
Azure AD Role
Any role with one of these permissions
microsoft.directory/applications/create
microsoft.directory/applications/createAsOwner
microsoft.directory/applications/allProperties/allTasks
Built-in roles
Application Administrator
Application Developer
Cloud Application Administrator
Global Administrator
Hybrid Identity Administrator
References
Azure AD built-in roles
Application registration permissions for custom roles in Azure Active Directory

Azure resource access management and its relation with tenant

Azure ARM handles identity requirements for the requests it receives through Azure AD. The requesting user should be a valid Azure AD user with a valid identity and authorization roles. The azure subscription for which the request is made should comply to deployment limits and biling policies.
There is a role of Azure Tenant that is associated with requesting user and Subscription. What role these tenants play and what is the workflow ?
I'm not sure what you mean exactly by the role of the Azure tenant in this context, but you can assign roles at the tenant scope and that's what the ARM template documentation describes. For example, you can assign an Owner role to a user at the tenant scope so that the user is an Owner of the tenant. As for the relationship between tenants and subscriptions, multiple subscriptions can trust the same Azure AD tenant, but each subscription can only trust a single tenant. You can associate a subscription with a tenant by logging in and selecting the Subscription, and then changing the directory. With a Global Admin or User Admin role, you can add or remove users from your tenant.
As I'm sure you already know, an Azure tenant is a dedicated and trusted instance of Azure AD. Typically, each tenant represents a single organization. The words "tenant" and "directory" are used interchangeably. The tenant is an account in Azure that comes with a subdomain and an associated Azure Active Directory. In order to use an Azure Active Directory you need to become a tenant within the system. So a tenant is basically securing a .onmicrosoft.com subdomain. At that point you would have one account registered in your Azure AD.
So in the context of the ARM template, you need an Azure tenant to house your users and link to your subscriptions.
A tenant represents an organization in Azure Active Directory. It's a dedicated Azure AD service instance that an organization receives and owns when it signs up for a Microsoft cloud service such as Azure, Microsoft Intune, or Microsoft 365. Each Azure AD tenant is distinct and separate from other Azure AD tenants. Once you have an Azure AD tenant, you can define an application and assign it permissions so it can call REST APIs. Your organization may already have an Azure AD tenant that you can use for your application.
In Azure AD, users are segmented into tenants. A tenant is a logical construct that represents a secure, dedicated instance of Azure AD typically associated with an organization. Each subscription is associated with an Azure AD tenant. Next, the ARM checks whether the user has sufficient permission to access a resource using Azure RBAC (Role based Access Control) which manages the permissions. An Azure role specifies a set of permissions a user may take on a specific resource. Next, the resource request is checked against an Azure Resource Policy which are defined to allow specific operations for a specific resource. Next, ARM checks the Azure subscription limit for the specific resources in that subscription for resource groups. And finally, the financial commitment associated with the subscription is checked as a final control before deploying the resource for management through the ARM.
ARM flow and working
Please find the below Microsoft documentation for your reference: -
https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/govern/resource-consistency/resource-access-management
Thanking you,

Using IAM for Azure Service Bus, how can I assign a role to an application?

Background
I want to give an application ownership of several of my Azure Service Bus queues ... specifically, by granting it the Azure Service Bus Data Owner role.
The Azure Service Bus documentation says this is possible:
Azure Service Bus supports using Azure Active Directory (Azure AD) to authorize requests to Service Bus entities (queues, topics, subscriptions, or filters). With Azure AD, you can use role-based access control (RBAC) to grant permissions to a security principal, which may be a user, group, or application service principal [my emphasis].
(Source)
However, I can't find a way to do it.
What I've Tried
Registered the application in Azure AD.
Granted the application the user_impersonation permission on Microsoft.ServiceBus. (Application permissions is disabled [1], so I selected Delegated permissions and checked user_impersonation [2]. No idea if that's right. I posted another question a while ago about Application permissions being disabled, but the accepted answer of editing the manifest doesn't work in this case.)
In my Service Bus queue, selected Role assignments.
Clicked Add.
Searched for my application.
Issue
My application doesn't appear in the search results in Role assignments.
A service principal is the instance of an application in a given tenant. (Multi-tenant applications can have service principals in many tenants, all referring back to a single app registration.)
To grant an Azure role to an application, a service principal must first exist in the tenant. To check if the service principal for an app registration already exists in the same tenant where the app is registered (and create it if it doesn't):
Using the Azure portal:
Navigate to Azure AD > App registrations > (app) > Overview
Under the Managed application in local directory heading:
If you see a link with the name of the app, the service principal already exists.
If you see a "Create service principal" link, clicking it will attempt to create the service principal.
Using Azure CLI:
az ad sp show --id {app-id}
az ad sp create --id {app-id}
Using Azure AD PowerShell:
Get-AzureADServicePrincipal -Filter "appId eq '{app-id}'"
New-AzureADServicePrincipal -AppId "{app-id}"

What's the use of a service principal without role assignment

Service principle can be created without role via az ad sp create-for-rbac --skip-assignment
Q1. What's the use of a service principal without a role?
Q2. Can a service principle exit without attaching to any scope/resource? If so what's the use of such independent service principle?
Q1. What's the use of a service principal without a role?
The parameter --skip-assignment skip assigning the service principal to the subscription. So to be precise, your question should be without an RBAC role, because there is another role named Administrator role, it will be mentioned below.
Some usages here for you to refer to, there are many usages mixed with the AD App, will not go into details here. If you want to learn about them, you can look into the Azure AD official doc.
1.The service principal can be assigned as an Administrator role in Azure AD, then it can do the things depend on the role permissions, e.g. create a user, delete a group. Via Azure AD powershell, Microsoft Graph API, Azure AD Graph API, or the AAD part of the Az powershell module.
2.The service principal can also calls the APIs and use the powershell above without Administrator role, but you need to give the application permission to it. The az ad sp create-for-rbac will create an AD App along with a service principal, in the AD App in the portal -> API permissions, you can add the permission and consent. Note, when we add permissions and consent in AD App, actually the permissions will be given to the service principal in your tenant, the service principal is an instance of the AD Application in a specific tenant.
Q2. Can a service principle exit without attaching to any scope/resource? If so what's the use of such independent service principle?
Yes, as mentioned above, it can do many things related to Azure AD, Graph API. Here is a doc about Application and service principal objects in Azure Active Directory, it will be really helpful for you to understand the service principal.
A1- you can use it to remove the need of secret keys in your apps. For example, rather than storing the Azure Storage access key, you can grant an identity (your app) to store / access data on Azure Storage.
A2-I think so, it will be a system-assigned managed identity which is a special kind of managed identity (service principal)

What is the difference between IAM and Azure AD on the azure cloud?

What is the difference between IAM and Azure AD on the azure cloud?
They don't make it clear.
Identity Access Management is what they call the Role-Based Access Control system in Azure subscriptions. Basically, it allows you to give users certain roles on subscriptions, resource groups, or individual resources.
Azure AD is a more general identity management solution. It allows you to manage users and applications, users' access to those applications and more. Calling it the "same as on-prem AD" is not really quite right, since their features differ quite a lot. The general purpose is similar to on-prem AD of course.
Logically Azure subscriptions exist within one Azure AD (they are linked to one). But having your user account in Azure AD does not give you access to Azure subscriptions! In addition to a user having to be a member (or invited guest user) of the AAD assigned to the subscription, you also have to use the RBAC (IAM) system to assign roles for users.
Azure AD is for Authentiction - User must prove who they are using a Username and Password
IAM (RBAC) is for Authorization - a User is assigned a role or permissions to use a specific resource.
What is the difference between IAM and Azure AD on the azure cloud?
Azure IAM is Azure Role-Based Access control (RBAC). Work for Azure subscription, to manage Azure resources.
Using RBAC, you can segregate duties within your team and grant only
the amount of access to users that they need to perform their jobs.
Instead of giving everybody unrestricted permissions in your Azure
subscription or resources, you can allow only certain actions. For
example, use RBAC to let one employee manage virtual machines in a
subscription, while another can manage SQL databases within the same
subscription.
Azure AD same as on-prem AD, create users to access or manage some applications.
Azure IAM same as Active directory group(have some permissions), Azure AD users in this group will have those permissions.
Identify and access management (IAM) is called RBAC (Role-Based Access Control). This is used to grant level of access such as reader , contributor , owner to Azure resources and hence perform role assignment.
Azure AD is identity management solution for Azure. It is a live directory or a database that stores the user accounts and their password.

Resources