Forum Discussion
Suleyman Ali
Sep 15, 2023Iron Contributor
Uploading app icons for manage apps in intune using microsoft graph SDK Powershell
hi all, I am creating a script to add apps to intune and assign them. currently, all is working well apart from uploading the icon. Here is the portion of the body parameters $appBody = @...
Sep 19, 2023
I'm working on something similar, used this blog post https://rozemuller.com/add-microsoft-store-app-with-icon-into-intune-automated/ for that. Basically you create a Base64 of it
$imageUrl = "https://apps.microsoft.com/store/api/ProductsDetails/GetProductDetailsById/{0}?hl=en-US&gl=US" -f $exactApp.PackageIdentifier
$image = Invoke-RestMethod -Uri $imageUrl -Method GET
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($image.IconUrl, "./temp.jpg")
$base64string = [Convert]::ToBase64String([IO.File]::ReadAllBytes('./temp.jpg'))
and use that as icon like this, type should be string:
$deployUrl = "https://graph.microsoft.com/beta/deviceAppManagement/mobileApps"
$appBody = @{
'@odata.type' = "#microsoft.graph.winGetApp"
description = $appInfo.ShortDescription
developer = $appInfo.Publisher
displayName = $appInfo.packageName
informationUrl = $appInfo.PublisherSupportUrl
largeIcon = @{
"@odata.type"= "#microsoft.graph.mimeContent"
type = "String"
value = $base64string
}
installExperience = @{
runAsAccount = $appInstaller.scope
}
isFeatured = $false
packageIdentifier = $appId
privacyInformationUrl = $appInfo.PrivacyUrl
publisher = $appInfo.publisher
repositoryType = "microsoftStore"
roleScopeTagIds = @()
} | ConvertTo-Json
$appDeploy = Invoke-RestMethod -uri $deployUrl -Method POST -Headers $authHeader -Body $appBody