-
Notifications
You must be signed in to change notification settings - Fork 366
Steps to create config for MAM (Conditional access)
There is a scenario when a user of a client application wants to access resources protected by specific permissions (i.e. scopes) in a backend application. The resource is accessible only when certain app protection policies and access conditions are met. In such situation, an access token is issued only when the conditions are met.
This scenario includes a backend application, and an iOS and Android client applications. The setup for the two platforms is slightly different. This article describes the steps to correctly configure these applications for the above scenario to work. At the same time, the article avoids going into granular details. Read more in Code example and Intune Mobile App Management.
- Sign in to Azure Active Directory.
- Create a test user (e.g.
XamTestuser@XamTester.onmicrosoft.com
). - On the user profile page, go to Licenses.
- Click on Assignments and select the following:
- Azure Active Directory Premium License
- Enterprise Mobility + Security
- Intune
- Microsoft 365 Business standard
Note: These policies do not apply to guest users.
- Create a test group (e.g.
MAM_Test_Users
).
Note the name of the group. This will need to be assigned at later stages. - Add the new user to this group.
Register a backend application:
- In Azure Active Directory, go to Enterprise Applications section.
- Click on New application.
- Click Create your own application.
- Select Register an application to integrate with Azure AD (App you're developing) option.
- After Create screen, it will take you to Register An Application screen.
- Select Multitenant and click Register.
- This will take you to the screen in #1.
Enable conditional access:
- Navigate to Enterprise Applications.
- Select the application that you created.
- Assign the user group that was created earlier.
- Click on Conditional Access.
- Click New policy and select:
- In Users or workload identities, select the group that was created earlier.
- In Cloud Apps or actions, verify that this has the enterprise application that was created.
- In Conditions, select multiple options:
- Device Platforms - select Yes and choose iOS + Android.
- Client Apps - select Yes and select all the options.
- In Grant, select Require app protection policy.
- At the bottom of the screen in Enable Policy, select On.
- Click Create.
Configure permissions (e.e. scopes):
- Navigate to App registrations. (Note: This is not Enterprise applications.)
- Select the app you created.
- Click on "Add Application ID URI".
- Click on Add a scope (e.g. Hello.World).
- It will generate a Guid and Application ID Uri and ask you to create a scope.
- Note the URI of the scope. This is needed in the client application.
- Click on API Permissions section.
- Click on Add a permission.
- Select the permission created in the earlier stage and click Add Permission.
- Click Add a permission again.
- Select APIs my organization uses.
- Select Microsoft Mobile Application Management - DeviceManagementManagedApps.ReadWrite.
- Click Add permission.
- Grant Admin consent.
- In Azure Active Directory, go to App registration.
- Create a new app and choose multitenant option.
- Add platform URI for iOS.
- Add platform URI for Android.
- Go to API Permissions.
- Add permissions for the scope created in the backend application:
- Click on Add a Permission.
- Choose My APIs.
- Select the scope that was added in the backend app (i.e. Hello.World).
- Click Add a permission again
- Select APIs my organization uses.
- Select Microsoft Mobile Application Management - DeviceManagementManagedApps.ReadWrite.
- Click Add permission.
- Select Grant admin consent for your tenant (even if Admin consent required column shows No).
- Build a skeleton app with the client ID from the Azure AD.
- Make sure that the iOS app references Xamarin.Intune.MAM.SDK.iOS package.
- For iOS, the IPA file should be built.
- Build a skeleton app with the client ID from the Azure AD.
- Make sure that the Android app references Microsoft.Intune.MAM.Xamarin.Android package.
- For Android, the APK file should be built.
You will have to follow the same steps twice, once for the iOS app and again for the Android app with the differences as noted.
- Go to In Intune Portal.
- Create an app:
- For iOS, click on Apps > iOS Apps section.
- For Android, click on Apps -> Android Apps section.
- Select Add.
- Select App Type as Line-of-business app.
- Upload the build file.
- For iOS, select the .ipa file that was built.
- For Android, select the .apk file that was built.
- You may need to fill out some information in the App information, like Publisher name.
- In the Assignments screen, under Available for enrolled devices:
- Select Add all users.
- In the Assignments screen, under Available with or without enrollment:
- Select Add Group.
- Select the group that was created.
- Select Create to complete the client application registration.
You will have to follow the same steps twice, once for the iOS app and again for the Android app with the differences as noted.
- Go to In Intune Portal.
- Go to Apps > App Protection policies:
- For iOS, click Create Policy iOS/MacOS.
- For Android, click Create Policy Android.
- After the Basic screen, navigate to the Apps screen.
- In the Apps screen, set Target policy to Selected Apps.
- Under Custom Apps, select the app you created.
- On Data Protection screen, select the options you want, for example:
- Send org data to other apps - Policy managed apps.
- Save copies of org data - block.
- Click Next to advance to Access requirements screen.
- In Access requirements, keep the default values.
- In Conditional Launch, keep the default values.
- In Assignments > Included groups, add the group you created.
- Home
- Why use MSAL.NET
- Is MSAL.NET right for me
- Scenarios
- Register your app with AAD
- Client applications
- Acquiring tokens
- MSAL samples
- Known Issues
- Acquiring a token for the app
- Acquiring a token on behalf of a user in Web APIs
- Acquiring a token by authorization code in Web Apps
- AcquireTokenInteractive
- WAM - the Windows broker
- .NET Core
- Maui Docs
- Custom Browser
- Applying an AAD B2C policy
- Integrated Windows Authentication for domain or AAD joined machines
- Username / Password
- Device Code Flow for devices without a Web browser
- ADFS support
- High Availability
- Regional
- Token cache serialization
- Logging
- Exceptions in MSAL
- Provide your own Httpclient and proxy
- Extensibility Points
- Clearing the cache
- Client Credentials Multi-Tenant guidance
- Performance perspectives
- Differences between ADAL.NET and MSAL.NET Apps
- PowerShell support
- Testing apps that use MSAL
- Experimental Features
- Proof of Possession (PoP) tokens
- Using in Azure functions
- Extract info from WWW-Authenticate headers
- SPA Authorization Code