Skip to content

Commit b69a70a

Browse files
committed
Update to IntuneBrand set default
1 parent 4deefd1 commit b69a70a

File tree

2 files changed

+64
-19
lines changed

2 files changed

+64
-19
lines changed

CompanyPortalBranding/CompanyPortal_Get.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ NAME: Get-IntuneBrand
166166
[cmdletbinding()]
167167

168168
$graphApiVersion = "Beta"
169-
$Resource = "deviceManagement/intuneBrand"
169+
$Resource = "deviceManagement/intuneBrandingProfiles"
170170

171171
try {
172172

173173
$uri = "https://graph.microsoft.com/$graphApiVersion/$($resource)"
174-
Invoke-RestMethod -Uri $uri -Headers $authToken -Method Get
174+
(Invoke-RestMethod -Uri $uri -Headers $authToken -Method Get).value
175175

176176
}
177177

CompanyPortalBranding/CompanyPortal_Set_Default.ps1

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,51 @@ $authority = "https://login.microsoftonline.com/$Tenant"
149149

150150
####################################################
151151

152+
Function Get-IntuneBrand(){
153+
154+
<#
155+
.SYNOPSIS
156+
This function is used to get the Company Intune Branding resources from the Graph API REST interface
157+
.DESCRIPTION
158+
The function connects to the Graph API Interface and gets the Intune Branding Resource
159+
.EXAMPLE
160+
Get-IntuneBrand
161+
Returns the Company Intune Branding configured in Intune
162+
.NOTES
163+
NAME: Get-IntuneBrand
164+
#>
165+
166+
[cmdletbinding()]
167+
168+
$graphApiVersion = "Beta"
169+
$Resource = "deviceManagement/intuneBrandingProfiles"
170+
171+
try {
172+
173+
$uri = "https://graph.microsoft.com/$graphApiVersion/$($resource)"
174+
(Invoke-RestMethod -Uri $uri -Headers $authToken -Method Get).value
175+
176+
}
177+
178+
catch {
179+
180+
$ex = $_.Exception
181+
$errorResponse = $ex.Response.GetResponseStream()
182+
$reader = New-Object System.IO.StreamReader($errorResponse)
183+
$reader.BaseStream.Position = 0
184+
$reader.DiscardBufferedData()
185+
$responseBody = $reader.ReadToEnd();
186+
Write-Host "Response content:`n$responseBody" -f Red
187+
Write-Error "Request to $Uri failed with HTTP Status $($ex.Response.StatusCode) $($ex.Response.StatusDescription)"
188+
write-host
189+
break
190+
191+
}
192+
193+
}
194+
195+
####################################################
196+
152197
Function Set-IntuneBrand(){
153198

154199
<#
@@ -167,11 +212,12 @@ NAME: Set-IntuneBrand
167212

168213
param
169214
(
215+
$id,
170216
$JSON
171217
)
172218

173219
$graphApiVersion = "Beta"
174-
$App_resource = "deviceManagement"
220+
$Resource = "deviceManagement/intuneBrandingProfiles('$id')"
175221

176222
try {
177223

@@ -186,7 +232,7 @@ $App_resource = "deviceManagement"
186232

187233
Test-JSON -JSON $JSON
188234

189-
$uri = "https://graph.microsoft.com/$graphApiVersion/$($App_resource)"
235+
$uri = "https://graph.microsoft.com/$graphApiVersion/$($Resource)"
190236
Invoke-RestMethod -Uri $uri -Method Patch -ContentType "application/json" -Body $JSON -Headers $authToken
191237

192238
}
@@ -313,27 +359,26 @@ $JSON_Default = @"
313359
314360
{
315361
316-
"intuneBrand":{
317-
"displayName":null,
318-
"contactITName":null,
319-
"contactITPhoneNumber":null,
320-
"contactITEmailAddress":null,
321-
"contactITNotes":null,
322-
"privacyUrl":null,
323-
"onlineSupportSiteUrl":null,
324-
"onlineSupportSiteName":null,
362+
"displayName": "",
363+
"privacyUrl": "",
364+
"contactITName":"",
365+
"contactITPhoneNumber":"",
366+
"contactITEmailAddress":"",
367+
"contactITNotes":"",
368+
"onlineSupportSiteUrl":"",
369+
"onlineSupportSiteName":"",
325370
"themeColor":{"r":0,"g":114,"b":198},
326371
"showLogo":false,
327-
"showNameNextToLogo":false,
328-
"lightBackgroundLogo":null,
329-
"darkBackgroundLogo":null,
330-
"@odata.type":"#microsoft.management.services.api.intuneBrand"
331-
}
372+
"showDisplayNameNextToLogo":true
332373
333374
}
334375
335376
"@
336377

337378
####################################################
338379

339-
Set-IntuneBrand -JSON $JSON_Default
380+
$IntuneBrand = Get-IntuneBrand
381+
382+
$id = $IntuneBrand.id
383+
384+
Set-IntuneBrand -id $id -JSON $JSON_Default

0 commit comments

Comments
 (0)