An open API service indexing awesome lists of open source software.

https://github.com/microsoftconnect/Chatr-Sample-Intune-iOS-App

Chatr is a simple, open source, Swift based iOS app designed to let you test out the capabilities of the Microsoft Intune APP SDK
https://github.com/microsoftconnect/Chatr-Sample-Intune-iOS-App

Last synced: 2 months ago
JSON representation

Chatr is a simple, open source, Swift based iOS app designed to let you test out the capabilities of the Microsoft Intune APP SDK

Awesome Lists containing this project

README

          

# Chatr - An Intune MAM iOS SDK Example (Swift)
This application is a demonstration of the [Microsoft Intune SDK for iOS](https://github.com/msintuneappsdk/ms-intune-app-sdk-ios). A developer guide to the SDK is available [here](https://learn.microsoft.com/mem/intune/developer/app-sdk-ios). This project implements some commonly used features so developers integrating their apps with the SDK have an example to follow.

Chatr offers a simple messaging interface allowing users to send messages, print, and save conversations to their local device. It uses the [Microsoft Authentication Library](https://github.com/AzureAD/microsoft-authentication-library-for-objc) to authenticate users.

## Steps to run the app
In order to deploy this sample you will need an Intune subscription. Free trials are sufficient for this demo.

### Step 1: Setting up Intune
You will need at least one user assigned to a user group. You can see how to create new users [here](https://learn.microsoft.com/mem/intune/fundamentals/quickstart-create-user) and user groups [here](https://learn.microsoft.com/mem/intune/fundamentals/quickstart-create-group). Be sure to assign Intune licenses to your users [here](https://learn.microsoft.com/mem/intune/fundamentals/quickstart-create-user#assign-a-license-to-an-individual-user).

### Step 2: Create and Deploy App Protection Policy (APP)
To enable MAM without device enrollment (MAM-WE), we must create a new App Protection Policy with Intune. Instructions for creating and deploying a new APP can be found [here](https://learn.microsoft.com/mem/intune/apps/quickstart-create-assign-app-policy).
1. To create an APP targeting the Chatr sample app, click on **Create policy** in the "App protection policies" pane.
2. In the "Create policy" pane specify the protection policy name, description, and platform. Click on **Select required apps**.
3. At the top of the pane click **More apps** and scroll to the bottom of the pane.
4. Enter the Bundle ID of your app and click **Add**. The Chatr bundle ID can be found by selecting the project file in the Xcode project explorer, selecting the chatr target, and selecting the "General" tab. This app's bundle ID is `Intune.chatr`.
5. Hit **Select** at the bottom of the "Apps" pane.
6. Click the **Settings** button in the "Create policy" pane and set the policy settings you would like to apply to a user group for your app.
7. Once you have selected the settings click **OK** at the bottom of the Settings pane and then click **Create** at the bottom of the "Create policy" pane. Your app should now appear in the "App protection policies" pane.

### Step 3: Create and Deploy App Configuration Policy
Instructions for creating and deploying a new App Configuration Policy can be found [here](https://learn.microsoft.com/mem/intune/apps/app-configuration-policies-use-ios).
1. To create an App Configuration Policy targeting the Chatr sample app, click on **Add** in the "App configuration policies" pane.
2. In the "Add configuration policy" pane specify the configuration policy name and description. Under "Device enrollment type" select **Managed apps**. Click on **Select the required app**.
3. At the top of the pane click **More apps** and scroll to the bottom of the pane.
4. Enter the Bundle ID of your app and click **OK**. The Chatr bundle ID can be found by selecting the project file in the Xcode project explorer, selecting the chatr target, and selecting the "General" tab. This app's Package ID is `Intune.chatr`.
5. Click the **Configuration settings** button in the "Add configuration policy" pane and set the key-value pair configuration you would like to apply to a user group for your app. For intance, to change the messaging group name on the Chat Page of the Chatr sample app to "Intune", you can create a configuration where the key is "GroupName" and the value is "Intune".
6. Once you have added the key-value pair configuration click **OK** at the bottom of the "Configuration" pane and then click **Add** at the bottom of the "Add configuration policy" pane. Your app should now appear in the "App configuration policies" pane.

### Step 4: Register the App with Microsoft Entra ID
1. You'll need to configure an app registration in Microsoft Entra ID and specify the client ID and redirect URI that the Intune SDK should use. Instructions for creating an app registration can be found [here](https://learn.microsoft.com/azure/active-directory/develop/quickstart-register-app).
2. Once you have created the Entra registration, and it's showing up under All Applications, you must give your app access to the Intune Mobile App Management service. The steps can be found [here](https://learn.microsoft.com/en-us/intune/intune-service/developer/app-sdk-get-started#give-your-app-access-to-the-intune-mobile-app-management-service)
3. This app's bundle ID is `Intune.chatr`. Make sure you update this bundle ID to match the app registration. The bundle ID can be found by selecting the project file in the Xcode project explorer, selecting the chatr target, and selecting the "General" tab.
4. In the Info.plist file, update the values for `ADALClientId` and `ADALRedirectUri` under IntuneMAMSettings dictionary to match the client ID and redirect URI from your app registration. The redirect URI should be in the format `msauth.://auth`.
5. If your app registration was configured as a single-tenant app, you will also need to add the `ADALAuthority` value to the Info.plist file under IntuneMAMSettings. This can be skipped for multi-tenant app registrations.
6. The redirect URI scheme which is of the format `msauth.` needs to be added to the `CFBundleURLSchemes` in the Info.plist file.

### Step 5: Launch the App & Sign-In
Chatr should now be properly configured with Intune. When prompted to sign in, use one of the users in the group used in Step 2 or Step 3.
## Relevant Files
- `Chatr/LoginPage.swift` contains logic for authenticating and enrolling the user with Intune.
- `Chatr/EnrollmentDelegate.swift` contains logic which responds to an Intune enrollment or unenrollment attempt.
- `Chatr/PolicyDelegate.swift` contains logic for removing data for a specific user when a selective wipe command is received from the Intune MAM service and responding to when the Intune SDK needs to restart the application.
- `Chatr/KeychainManager.swift` contains logic for adding, updating, and removing user data in the keychain.
- `Chatr/ChatPage.swift`
- Registers the application to receive notifications when an IT administrator updates app configuration or protection policies.
- Contains all of the main functionality of the app.
- `Chatr/SettingsPage.swift` contains option to display the Intune Diagnostics Console, which end users can use to help IT administrators and Microsoft support diagnose issues.