[GH-ISSUE #2137] displayName and description not honored for Intune Device/Catalog templates #1095

Closed
opened 2026-03-02 13:41:33 +03:00 by kerem · 3 comments
Owner

Originally created by @DanielWahlgren on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/KelvinTegelaar/CIPP/issues/2137

Description

In Modules/CIPPCore/Public/Entrypoints/Invoke-AddPolicy.ps1
For Admin, it replaces the displayName and description with the information provided in the UI, but for Device- and Catalog-templates it does not. This is confusing, especially when trying to add the same policy twice. Changeing the name will give the errormessage that the new name already exist, but in reality, it's the original name that already exist, so the errormessage becomes missleading.

So more like this, except tested :)

                'Device' {
                    $TemplateTypeURL = 'deviceConfigurations'
                    $CreateBody = '{"description":"' + $description + '","displayName":"' + $displayname + '","roleScopeTagIds":["0"]}'
                    $CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant
                    if ($displayname -in $CheckExististing.displayName) {
                        Throw "Policy with Display Name $($Displayname) Already exists"
                    }
                    $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant -type POST -body $RawJSON
                }
                'Catalog' {
                    $TemplateTypeURL = 'configurationPolicies'
                    $CreateBody = '{"description":"' + $description + '","displayName":"' + $displayname + '","roleScopeTagIds":["0"]}'
                    $CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant
                    if ($displayname -in $CheckExististing.displayName) {
                        Throw "Policy with Display Name $($Displayname) Already exists"
                    }
                    $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant -type POST -body $RawJSON
                }

Environment data

Sponsored / Non-sponsored instance: Non-sponsored
Front end version number: 5.1.1
Back end version number: 5.1.2
Tried Tenant Cache Clear: false 
Tried Token Cache Clear: false
Originally created by @DanielWahlgren on GitHub (Feb 20, 2024). Original GitHub issue: https://github.com/KelvinTegelaar/CIPP/issues/2137 ### Description In Modules/CIPPCore/Public/Entrypoints/Invoke-AddPolicy.ps1 For Admin, it replaces the displayName and description with the information provided in the UI, but for Device- and Catalog-templates it does not. This is confusing, especially when trying to add the same policy twice. Changeing the name will give the errormessage that the new name already exist, but in reality, it's the original name that already exist, so the errormessage becomes missleading. So more like this, except tested :) ``` 'Device' { $TemplateTypeURL = 'deviceConfigurations' $CreateBody = '{"description":"' + $description + '","displayName":"' + $displayname + '","roleScopeTagIds":["0"]}' $CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant if ($displayname -in $CheckExististing.displayName) { Throw "Policy with Display Name $($Displayname) Already exists" } $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant -type POST -body $RawJSON } 'Catalog' { $TemplateTypeURL = 'configurationPolicies' $CreateBody = '{"description":"' + $description + '","displayName":"' + $displayname + '","roleScopeTagIds":["0"]}' $CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant if ($displayname -in $CheckExististing.displayName) { Throw "Policy with Display Name $($Displayname) Already exists" } $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenant -type POST -body $RawJSON } ``` ### Environment data ```PowerShell Sponsored / Non-sponsored instance: Non-sponsored Front end version number: 5.1.1 Back end version number: 5.1.2 Tried Tenant Cache Clear: false Tried Token Cache Clear: false ```
kerem 2026-03-02 13:41:33 +03:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 20, 2024):

Thank you for creating a bug. Please make sure your bug is indeed a unique case by checking current and past issues, and reading the complete documentation at https://docs.cipp.app/
If your bug is a known documentation issue, it will be closed without notice by a contributor. To confirm that this is not a bug found in the documentation, please copy and paste the following comment: "I confirm that I have checked the documentation thoroughly and believe this to be an actual bug."

Without confirming, your report will be closed in 24 hours. If you'd like this bug to be assigned to you, please comment "I would like to work on this please!".

<!-- gh-comment-id:1954721556 --> @github-actions[bot] commented on GitHub (Feb 20, 2024): Thank you for creating a bug. Please make sure your bug is indeed a unique case by checking current and past issues, and reading the complete documentation at https://docs.cipp.app/ If your bug is a known documentation issue, it will be closed without notice by a contributor. To confirm that this is not a bug found in the documentation, please copy and paste the following comment: "I confirm that I have checked the documentation thoroughly and believe this to be an actual bug." Without confirming, your report will be closed in 24 hours. If you'd like this bug to be assigned to you, please comment "I would like to work on this please!".
Author
Owner

@KelvinTegelaar commented on GitHub (Feb 20, 2024):

Already fixed in dev

<!-- gh-comment-id:1954757484 --> @KelvinTegelaar commented on GitHub (Feb 20, 2024): Already fixed in dev
Author
Owner

@DanielWahlgren commented on GitHub (Feb 20, 2024):

Thank you Kevin!

<!-- gh-comment-id:1954873835 --> @DanielWahlgren commented on GitHub (Feb 20, 2024): Thank you Kevin!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/CIPP#1095
No description provided.