In this guide, you’ll learn Add the ChatGPT App to Intune using Microsoft Graph API. The present discourse aims to elucidate the process of creating the New Microsoft Store apps via Graph API to automate the creation of the apps.
The Microsoft Store is equipped to accommodate a range of applications, including Universal Windows Platform (UWP) apps and desktop applications packaged in MSIX. Recently, the store has extended its support to include Win32 applications packaged in MSIX or EXE installers. The Windows Package Manager (Winget.exe) implements the new Microsoft Store app type.
I have already explained how to deploy a Microsoft Store application in Intune in my previous articles; I will add those articles here for your reference. As you probably know, Intune keeps Microsoft Store applications up to date when a new version of the application is available.
Since we already talked about the manually deployment many times, I am not explaining the manuall and easiest method to create and deploy and an Microsoft Store application with Intune here. As a passionate advocate for automation, I always keen to explore the automation capabilties of Intune.
Table of Contents
Know More About ChatGPT
As you may know, ChatGPT or Chat Generative Pre-Trained Transformer generative artificial intelligence chatbot developed by OpenAI and launched in 2022. ChatGPT can generate human-like conversational responses. Its trained to follow an instruction from you in a prompt and provide a detailed response.
ChatGPT is developed based on specific GPT foundation models, including GPT-4, GPT-4o, and GPT-4o mini, which were fine-tuned for conversational use. The fine-tuning process utilized supervised learning and reinforcement learning from human feedback (RLHF). Thanks to internet for the information.
- Best Guide to Restart Intune Devices Remotely using Microsoft Graph API and PowerShell
- Best Guide to Run Intune Device Query with Microsoft Graph API
- Automate Microsoft Intune Device Compliance Report using Graph API
The ChatGPT app was announced in October 2024 by OpenAI. You could use the free version of ChatGPT as browser or Windows app. You can download the latest version of ChatGPT app from the Microsoft Store and install it manually on your windows device.
How to Get Package Identifier Number
You would need packageIdentifier
number, which is a unique value that identifies the app to automate creation of any New Microsoft Store apps via Graph API. There are multiple ways to get the packageIdentifier
number. The app Package Identifier is the unique value that identifies the app
You can check the devloper document of the perticular application and get the packageIdentifier
from the document or you could get the packageIdentifier
number from the Intune portal itself. I have already explanied the proceess of getting the number in another article. Please go through it..!
Read More : Add Microsoft Store Apps to Intune using Microsoft Graph API
I have already noted the packageIdentifier
number of ChatGPT. 9NT1R1C2HH7J is the Package Identifier value of ChatGPT application.
- Install New Outlook for Windows with Microsoft Store App from Intune
- Best Guide to Install Windows App from New Microsoft Store in Intune
- Microsoft Store for Business Apps will be Deleted Soon
Add ChatGPT App using Microsoft Graph API
We are all set to add a ChatGPT via Graph API. The package identifier value that you noted above will be used in the request body while running the API call. Let’s learn how to create a Microsoft Store App via Graph API.
- Manage Intune Tasks with PowerShell Part 1
- Managing Windows Bitlocker Compliance Policy Using Intune | MS Graph | Grace Period
I will use Graph Explorer, a handy browser-based tool for running your Graph calls. However, it does not support commands in batch and is a single-line command executor. API calls will be made by utilizing the Graph Explorer.
NOTE! You may need to log in to Graph Explorer using your credentials if it's your first time.
You must have certain permissions to create Microsoft Store apps using Graph API. Below are the two permissions that you should ensure you have before you start automating the task.
Permission | Description |
---|---|
DeviceManagementApps.Read.All | Allows the app to read the properties, group assignments and status of apps, app configurations and app protection policies managed by Microsoft Intune. |
DeviceManagementApps.ReadWrite.All | This allows the app to read and write the properties, group assignments and status of apps, app configurations and app protection policies managed by Microsoft Intune. |
- Sign in the to Graph Explorer with your admin account.
- Replace the Graph URL with the following endpoint.
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps
You should use the POST request method for the endpoint since you are Sending Data to APIs. Change the request method from GET to POST and paste the below JSON code to the request body.
{
"@odata.type": "#microsoft.graph.winGetApp",
"displayName": "ChatGPT - HTMD",
"description": "The official ChatGPT desktop app brings you the newest model improvements from OpenAI, including access to OpenAI o1-preview, our newest and smartest model.",
"publisher" : "OpenAI",
"packageIdentifier": "9NT1R1C2HH7J",
"owner" : "Sujin Nelladath",
"installExperience": {
"runAsAccount": "user"
}
}
The automation of the creation of the ChatGPT will not work with the given request body. You could add many more properties like notes, informationUrl, largeIcon etc. When using the above JSON code, please ensure that you replace the values with your own.
Verify the Request Body input values and Click on Run query. Within seconds of clicking Run query, you will receive a success message with the text created – 201.
You would get response message as below. You can review the newly created application properties in the response message.
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#deviceAppManagement/mobileApps/$entity",
"@odata.type": "#microsoft.graph.winGetApp",
"id": "364f20e9-35a4-4427-9560-92407a9ba477",
"displayName": "ChatGPT - HTMD",
"description": "The official ChatGPT desktop app brings you the newest model improvements from OpenAI, including access to OpenAI o1-preview, our newest and smartest model.",
"publisher": "OpenAI",
"largeIcon": null,
"createdDateTime": "2025-01-11T06:54:51.8802994Z",
"lastModifiedDateTime": "2025-01-11T06:54:51.8802994Z",
"isFeatured": false,
"privacyInformationUrl": null,
"informationUrl": null,
"owner": "Sujin Nelladath",
"developer": null,
"notes": null,
"uploadState": 2,
"publishingState": "processing",
"isAssigned": false,
"roleScopeTagIds": [],
"dependentAppCount": 0,
"supersedingAppCount": 0,
"supersededAppCount": 0,
"manifestHash": null,
"packageIdentifier": "9NT1R1C2HH7J",
"installExperience": {
"runAsAccount": "user"
}
}
PowerShell Script to Create ChatGPT App in Intune
Are you a PowerShell person? Well, I have devolped a PowerShell Script for you to Create ChatGPT App in Intune. However, please rememer to connect to MS Graph in PowerShell using Connect-MgGraph cmdlet. You’ll need to sign in with an admin account to consent to the required scopes.
- Best Guide to Restart Intune Devices Remotely using Microsoft Graph API and PowerShell
- Intune Policy Assignment Classification Easy Secrets of using Graph API with PowerShell
###########################################################################
#Add-MicrosoftStoreAppstoIntune.ps1
#Scope : This script will add to ChatGPT Microsoft Intune
#Author : Sujin Nelladath
#LinkedIn : https://www.linkedin.com/in/sujin-nelladath-8911968a/
############################################################################
# Connect to Microsoft Graph API with required permission
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Install-Module Microsoft.Graph -Scope CurrentUser -force
#Connect to MgGraph
Connect-MgGraph -Scopes DeviceManagementApps.ReadWrite.All
#Graph URL
$CreateAPP_URL = "https://graph.microsoft.com/beta/deviceAppManagement/mobileApps"
#Request body
$body = @"
{
`"@odata.type`": `"#microsoft.graph.winGetApp`",
`"displayName`": `"ChatGPT`",
`"description`": `"The official ChatGPT desktop app brings you the newest model improvements from OpenAI, including access to OpenAI o1-preview, our newest and smartest model.`",
`"publisher`" : `"OpenAI`",
`"packageIdentifier`": `"9NT1R1C2HH7J`",
`"owner`" : `"Sujin Nelladath`",
`"installExperience`": {
`"runAsAccount`": `"user`"
}
}
"@
Invoke-MgGraphRequest -Uri $CreateAPP_URL -Method POST -Body $Body
- Time to use Microsoft Graph Device Management PS Module Instead of MS Graph Intune Module.
- Best Guide to Install Microsoft Graph PowerShell Modules
Open the PowerShell ISE as administrator. Its always recommed to execute your automation task as administrator. Paste the above code and Run the script.
Once you execute the above script, you will receive the output below within seconds. The newly created application details will be there in the output.
Verify the ChatGPT App in Intune Portal
We learned how to automate the creation of the ChatGPT App using Microsoft Graph API and the PowerShell Script. Quickly log in to the Intune portal and verify the ChatGPT app.
- Sign in to the Microsoft Intune Admin portal.
- Select Apps > All Apps
- Enter the name of the application in the search bar.
I trust that this article will significantly benefit you and your organization. I appreciate your patience in reading this post. I look forward to seeing you in the next post. Keep supporting the HTMD Community.
Need Further Assistance or Have Technical Questions?
Join the LinkedIn Page and Telegram group to get the latest step-by-step guides and news updates. Join our Meetup Page to participate in User group meetings. Also, Join the WhatsApp Community to get the latest news on Microsoft Technologies. We are there on Reddit as well.
Author
About the Author: Sujin Nelladath, a Microsoft Graph MVP with over 11 years of experience in SCCM device management and Automation solutions, writes and shares his experiences with Microsoft device management technologies, Azure, DevOps and PowerShell automation.