Automating User/Group Assignment in Azure for SSO Applications

DiptiRanjan Swain 216 Reputation points
2025-05-02T11:46:01.16+00:00

An application in Microsoft Entra is used for federated single sign-on (SSO) with SAML-based authentication. The goal is to automate the assignment of users and groups to this application using a service account, while facing the following challenges:

According to organizational policy, the automation account cannot be granted roles such as Cloud Application Administrator, Application Administrator, or User Administrator. While it is possible to make the account the owner of the application, bypassing MFA during automatic login is not feasible.

Has anyone successfully implemented automation for user/group assignment under these constraints?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,580 questions
{count} votes

Accepted answer
  1. Navya 18,595 Reputation points Microsoft External Staff Moderator
    2025-05-06T13:26:57.8966667+00:00

    Hi @DiptiRanjan Swain

    To automate user or group assignments in Azure for Single Sign-On (SSO) applications, follow these steps:

    1.Create a Dynamic Group in Azure:

    Navigate to Microsoft Entra ID > Groups > New group.

    Set the group type to Security and membership type to Dynamic User.

    Define a membership rule based on user attributes. user.department -eq ABC

    2.Assign the Dynamic Group to Your Application:

    Go to Enterprise Applications > Your Application > Users and groups.

    Click add user/group, select the dynamic group, and assign it to the application.

    3.Ensure that users who should have access to the application have their department attribute set to "ABC" With this setup, any user whose department attribute is set to "ABC" will automatically be added to the dynamic group.

    Since this group is assigned to the application, these users will gain access without manual intervention.

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


2 additional answers

Sort by: Most helpful
  1. David Broggy 6,196 Reputation points MVP Moderator
    2025-05-02T13:21:57.0433333+00:00

    HI DiptiRanjan,

    I'd like to understand your need to auto-assign admin accounts to your app.

    Typically admin accounts are limited and only enabled when needed like with PIM.

    The application can be assigned a managed identity, to which admin roles can be applied.

    The onboarding of users to your app should not involve admin level privileges.

    However it's possible I don't understand your specific requirements for adding admins to your app.

    Here are some references which may help:

    Microsoft Graph API Documentation

    Microsoft Graph API for Application Management: https://learn.microsoft.com/en-us/graph/api/resources/application?view=graph-rest-1.0

    App Role Assignments with Graph API: https://learn.microsoft.com/en-us/graph/api/serviceprincipal-post-approleassignments?view=graph-rest-1.0

    Microsoft Entra ID Automation

    Custom Roles in Microsoft Entra ID: https://learn.microsoft.com/en-us/azure/active-directory/roles/custom-overview

    Permissions and Consent Framework: https://learn.microsoft.com/en-us/azure/active-directory/develop/permissions-consent-overview

    Enterprise Application Management

    Managing Enterprise Applications: https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/what-is-application-management

    Automated User Provisioning: https://learn.microsoft.com/en-us/azure/active-directory/app-provisioning/user-provisioning

    Security Best Practices

    Security Best Practices for Application Management: https://learn.microsoft.com/en-us/azure/security/fundamentals/identity-management-best-practices

    Best regards.


  2. DiptiRanjan Swain 216 Reputation points
    2025-05-09T14:35:54.4266667+00:00

    Hi @Navya, I turned off "Assignment Required" option on the application in Azure. Now I don't need to add any user/group to it. Just mapping their object id to the 3rd party application's role, allows them to login only with their role.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.