{"id":14968270,"url":"https://github.com/jtone123/xam-mdm","last_synced_at":"2026-03-03T12:44:27.081Z","repository":{"id":185840499,"uuid":"605145172","full_name":"JTOne123/XAM-MDM","owner":"JTOne123","description":"This article and reference project describe the basic mechanisms for delivering managed MDM/Intune configuration to MAUI/Xamarin apps such as Android, iOS, and UWP.","archived":false,"fork":false,"pushed_at":"2023-02-28T14:00:16.000Z","size":2441,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T18:12:36.937Z","etag":null,"topics":["android","intune","ios","managed-configurations","mdm","uwp","xamarin"],"latest_commit_sha":null,"homepage":"https://pavlodatsiuk.hashnode.dev/how-to-develop-maui-xamarin-with-mdm-intune-support","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JTOne123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-22T14:42:40.000Z","updated_at":"2023-08-23T03:15:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"826f34f8-b4af-462b-bdb3-646501d6b6e7","html_url":"https://github.com/JTOne123/XAM-MDM","commit_stats":null,"previous_names":["jtone123/xam-mdm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JTOne123%2FXAM-MDM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JTOne123%2FXAM-MDM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JTOne123%2FXAM-MDM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JTOne123%2FXAM-MDM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JTOne123","download_url":"https://codeload.github.com/JTOne123/XAM-MDM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610341,"owners_count":21132919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","intune","ios","managed-configurations","mdm","uwp","xamarin"],"created_at":"2024-09-24T13:39:37.397Z","updated_at":"2026-03-03T12:44:26.993Z","avatar_url":"https://github.com/JTOne123.png","language":"C#","funding_links":["https://www.buymeacoffee.com/pauldatsiuk"],"categories":[],"sub_categories":[],"readme":"**In this article**\n   * [What is MDM and why Intune?](#what-is-mdm-and-why-intune)\n   * [How to develop an MAUI/Xamarin app with MDM support (including Intune example)](#how-to-develop-an-mauixamarin-app-with-mdm-support-including-intune-example)\n   * [Implementation](#implementation)\n      * [Android](#android)\n      * [iOS](#ios)\n      * [UWP](#uwp)\n   * [Testing](#testing)\n      * [Android](#android-1)\n      * [iOS](#ios-1)\n      * [UWP](#uwp-1)\n   * [Intune](#intune)\n      * [Android](#android-2)\n      * [iOS](#ios-2)\n      * [UWP](#uwp-2)\n   * [End Devices Enrollment](#end-devices-enrollment)\n\nWhat is MDM and why Intune?\n=====\n![XAM-MDM proj logo](Images/XAM-MDM.png)\nMobile device management involves administering a large fleet of mobile devices, including smartphones, tablet computers, and laptops. You can deliver settings, apps, and certificates to end devices with MDM. There are various types of MDM solutions available, but I opted for Microsoft Intune as part of the Microsoft tech stack, which should be familiar to .NET developers and Azure IT experts. Additionally, it offers a trial period for us to test our app. It's worth noting that our current approach is compatible with any third-party MDM solution, such as SOTI, Citrix, Blackberry, and more.\n\nLet's start right away with the source code for the demo app. You can find it through the following [link](https://github.com/JTOne123/XAM-MDM).\n\nHow to develop an MAUI/Xamarin app with MDM support (including Intune example)\n====\nThe primary purpose of MDM support is to deliver configurations to the app, known as Managed configuration. Each platform has a slightly different approach for obtaining data from MDM and testing it. We use MAUI as a basic implementation, but on Xamarin Forms, everything works similarly. This concept also applies to all native apps, so you can explore it even if you are unfamiliar with Xamarin or MAUI.\n\nImplementation\n====\nLet's review the basic implementation. I've divided the implementation into several files and placed them on each platform. Hopefully, this will make it easier to copy the code to older Xamarin projects. While you can specify many managed configurations, for simplicity's sake, I've only created one. Here's a shared manager class that allows us to read the managed configuration by its key.\nhttps://github.com/JTOne123/XAM-MDM/blob/b815a7c5f51dd8a9f811c40093df25f95665603c/XAM-MDM/MauiApp1/ManagedConfigurationProvider.cs#L1-L7\n\n\n## Android\nThe foundation of the Android implementation is the [RestrictionsManager](https://developer.android.com/work/managed-configurations). To begin, we must define our app's remote configuration options by including the next element in our manifest's \u0026lt;application\u0026gt; element.\nhttps://github.com/JTOne123/XAM-MDM/blob/b815a7c5f51dd8a9f811c40093df25f95665603c/XAM-MDM/MauiApp1/Platforms/Android/AndroidManifest.xml#L1-L8\n \nThen describe the main details of the restriction.\nhttps://github.com/JTOne123/XAM-MDM/blob/b815a7c5f51dd8a9f811c40093df25f95665603c/XAM-MDM/MauiApp1/Platforms/Android/Resources/xml/app_restrictions.xml#L1-L8\n\nNext, retrieve the system service and read a value from the bundle.\nhttps://github.com/JTOne123/XAM-MDM/blob/b815a7c5f51dd8a9f811c40093df25f95665603c/XAM-MDM/MauiApp1/Platforms/Android/ManagedConfigurationProvider.cs#L1-L23\n\nFor more information, please refer to the following [link](https://developer.android.com/work/managed-configurations).\n\n## iOS\nFor iOS, the process is much simpler: we need to retrieve a specific dictionary from the user preferences. That's all there is to it.\nhttps://github.com/JTOne123/XAM-MDM/blob/b815a7c5f51dd8a9f811c40093df25f95665603c/XAM-MDM/MauiApp1/Platforms/iOS/ManagedConfigurationProvider.cs#L1-L22\n\nFor more information, please see the following [link](https://developer.apple.com/documentation/devicemanagement).\n\n## UWP\nThe same applies to UWP as well.\nhttps://github.com/JTOne123/XAM-MDM/blob/b815a7c5f51dd8a9f811c40093df25f95665603c/XAM-MDM/MauiApp1/Platforms/Windows/ManagedConfigurationProvider.cs#L1-L22\n \nTo learn more, please refer to the following [link](https://learn.microsoft.com/en-us/windows/client-management/mdm/enterprisemodernappmanagement-csp).\n\nTesting\n=====\nThis section will discuss how to test our code locally without publishing the app to app stores. Although the implementations are simple, testing is crucial to ensure the quality of the code. Let's take a look at the available options for testing.\n\n## Android\nTo test the Android app locally, Google [recommends](https://source.android.com/docs/devices/admin/testing-setup?hl=en) using their [TestDPC app](https://play.google.com/store/apps/details?id=com.afwsamples.testdpc\u0026hl=en). To begin, install the app and enroll the device. Then select your app and apply managed settings.\n\n## iOS\nFor iOS, you can easily set user preferences using the xcrun command in your terminal and test it with a simulator. Use the following commands to set or remove preferences:\n\n*To set*\n```\nxcrun simctl spawn booted defaults write com.pavlodatsiuk.xammdm com.apple.configuration.managed -dict 'key1' 'VALUE1'\n```\n*To remove*\n```\nxcrun simctl spawn booted defaults delete com.pavlodatsiuk.xammdm\n```\n\n## UWP\nUnfortunately, there is no straightforward approach for delivering settings locally for UWP. However, you can build a local package and deliver it with Intune along with its settings. So, let's move on to the next section of this article right away.\n\nIntune\n====\nLet's log in to our Intune portal using the following [link](https://endpoint.microsoft.com/#home). Please note that you must have an Azure AD Premium P2 license or trial, and you can obtain a free trial on the [Azure portal](https://portal.azure.com/#view/Microsoft_AAD_IAM/LicensesMenuBlade/~/Overview).\n\nI want to explain how to install apps from app stores as the primary source. So, before proceeding with this article, it is generally required that you publish your app on official stores to make it available in the stores for Intune. However, we will make an exception for Windows and deploy the app to test our implementation before releasing it to the Microsoft Store.\n\nTo configure everything for your apps, we will switch between two primary tabs on the left side of the Intune website: Apps and Devices.\n\n![intune website left tabs](Images/intune-left-tab.png)\n \n### The overall configuration requires three main steps:\n1.\tAdd an app from the store.\n2.\tSelect assignments for users.\n3.\tSet up managed configuration.\n\n### Prerequisites\n1.\t[Microsoft Endpoint Manager admin center](https://endpoint.microsoft.com/#home)\n2.\tAzure AD Premium P2 license (or trial)\n3.\t[Azure Active Directory](https://portal.azure.com/#view/Microsoft_AAD_IAM/LicensesMenuBlade/~/Overview)\n\n## Android\nTo add your app, go to the Apps section and select Android. Then, click on the Add button. Choose \"Managed Google Play app\" as the app type. \nYou must log in to your Google Play account using your credentials, and you need to do this once.\nAfter logging in, find your app in the window that appears. Click on the \"Approve\" button, followed by the \"Sync\" button.\n![new android app](Images/add-app-android.png)\n\nOnce you have added your app, you must assign it to end users or end devices. For testing purposes, you can assign it to everyone.\n![assigment](Images/assigment.png)\n\nThe final step is to configure your app's managed settings. Go to the Apps tab and select \"App Configuration policies\" followed by \"Managed devices\".\n![android configuration](Images/droid-config.png)\n \nThen select the platform, profile, and the app itself. In our case, it should be Android Enterprise or iOS/iPadOS for iOS.\nWe must select your managed configuration and permission if required on the next screen.\n![android configuration](Images/managed-configuration.png)\n\nThat's it! You need to wait for the changes to take effect. If you want to speed up the process, you can force the changes by clicking on the \"Sync\" button under Devices -\u003e Android -\u003e Android devices -\u003e Your devices.\n\n## iOS\nThe configuration process for the iOS app is nearly identical to that of the Android. Please refer to the Android section above for guidance. The only difference lies in adding the Apple MDM Push certificate under the Devices tab.\nTo upload the certificate, simply follow the instructions provided on the Apple Push Certificates Portal webpage. Additional information can be found at the following [link](https://learn.microsoft.com/en-us/mem/intune/enrollment/apple-mdm-push-certificate-get).\n![ios mdm push certificate](Images/ios-push-cert.png) \nOnce the MDM push certificate has been added, return to the Apps tab, and proceed with the app configuration process. To add a new app, click on the Add button located in the Apps -\u003e iOS store app, and follow the same steps as for Android.\n\n## UWP\nThere are a few points regarding the UWP app that I would like to highlight:\n1.\t[We intend to distribute the app package for testing purposes.](#the-local-app-package-for-testing)\n2.\t[The app can also be installed from the Microsoft Store, like how it was set up for Android and iOS.](#from-microsoft-store)\n3.\t[The process for configuring managed settings is notably different.](#managed-configuration)\n\n### The local app package for testing\nTo deliver an app packaged in an msixbundle, please follow these steps:\n1.\tGo to the \"Apps\" tab.\n2.\tClick the \"Add\" button.\n3.\tSelect \"Other/Line-of-business app.\"\n4.\tUpload the app package.\n5.\tSync the device.\n\n![line-of-business app](Images/win-LOB.png) \n\nPlease be aware that the installation process may fail if you have not installed a test certificate that is automatically included in the app package. To avoid this issue, install the certificate in the Trusted People certificate store. For more information, please refer to the [link](https://learn.microsoft.com/en-us/appcenter/distribution/installation) provided. You can either manually install the certificate or deliver the root certificate with Intune to the end device.\n\n### From Microsoft Store\nAnother option for setting up Windows apps is similar to Android, which involves selecting an app from the Microsoft Store. To do this, go to the \"Apps\" tab and click the \"Add\" button. Then, select the \"Microsoft Store app (new)\" option and choose the desired app.\n\nWhen configuring the app, make sure to specify assignments to user groups or devices, as it is a required step. So, don't forget to complete this step.\n\n### Managed configuration\nAs mentioned, delivering managed configuration to the Windows app requires a slightly different approach. \nTo deliver managed configuration for Windows apps, you must follow a slightly different approach. First, go to the \"Devices\" section and select \"Windows\" to view your Windows devices. Then, move to the \"Configuration Profiles\" section and create the \"Custom\" profile using templates for the Windows 10 platform. \n![windows configuration profiles](Images/windows-custom-profile.png) \n\nDefine a name for the profile and click \"Next\".\nIn the \"Configuration settings\" step, add a new OMA-URI setting and fill in all necessary fields. Enter **./User/Vendor/MSFT/EnterpriseModernAppManagement/AppManagement/AppStore/*maui-package-name-placeholder_9zz4h110yvjzm*/AppSettingPolicy/*MyMDMConfigKey*** in the OMA-URI field, where ***maui-package-name-placeholder_9zz4h110yvjzm*** refers to the package family name and ***MyMDMConfigKey*** is the managed configuration name defined in your code. \n![uwp managed configuration](Images/uwp-managed-config.png) \n![uwp package family name](Images/package-family-name.png) \n\nFinally, proceed to the subsequent steps and assign the relevant user groups. Sync your device and wait for the delivery of the configuration.\n\nEnd Devices Enrollment\n=====\nFirst, you must enroll your end devices by installing the [Intune Company Portal app](https://learn.microsoft.com/en-us/mem/intune/user-help/sign-in-to-the-company-portal) and logging in to your account. This account consists of a list of users defined in your AAD. All other configurations for your end devices can be completed through the Intune website.\n\nIn conclusion, I hope this article has provided more clarity than confusion. \nPlease follow me for exciting future reads.\n\n\u003ca href=\"https://www.buymeacoffee.com/pauldatsiuk\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtone123%2Fxam-mdm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtone123%2Fxam-mdm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtone123%2Fxam-mdm/lists"}