Home

Duplicating Device Configuration Profiles

%3CLINGO-SUB%20id%3D%22lingo-sub-777331%22%20slang%3D%22en-US%22%3ERe%3A%20Duplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-777331%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F363069%22%20target%3D%22_blank%22%3E%40JayWilliams%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ethere%20is%20also%20the%20option%20to%20use%20some%20PowerShell%20code%20provides%20by%20MS%20for%20this%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIntune%20PowerShell%20SDK%20(%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FIntune-PowerShell-SDK%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoft%2FIntune-PowerShell-SDK%3C%2FA%3E)%3C%2FLI%3E%0A%3CLI%3EPowerShell%20Intune%20Samples%20(%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fpowershell-intune-samples%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fpowershell-intune-samples%3C%2FA%3E).%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIn%20the%20PowerShell%20Intune%20Samples%20you%20have%20functional%20scripts%20for%20Export%2FImport%20of%20Device%20Configurations%2C%20see%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fpowershell-intune-samples%2Ftree%2Fmaster%2FDeviceConfiguration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fpowershell-intune-samples%2Ftree%2Fmaster%2FDeviceConfiguration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ebest%2C%3CBR%20%2F%3EOliver%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-777852%22%20slang%3D%22en-US%22%3ERe%3A%20Duplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-777852%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F174439%22%20target%3D%22_blank%22%3E%40Oliver%20Kieselbach%3C%2FA%3E%26nbsp%3BThanks!%20I'm%20sure%20those%20work%20just%20as%20well.%20This%20was%20a%20good%20opportunity%20to%20show%20the%20power%20of%20using%20the%20Graph%20API.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EA%20benefit%20for%20me%20using%20this%20vs%20PowerShell%20is%20not%20having%20an%20environment%20to%20maintain.%20Probably%20doesn't%20matter%20if%20using%20Cloud%20Shell%20but%20never%20hurts%20to%20know%20more%20than%20one%20way%20to%20skin%20the%20cat.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-784137%22%20slang%3D%22en-US%22%3ERe%3A%20Duplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-784137%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F363069%22%20target%3D%22_blank%22%3E%40JayWilliams%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20was%20an%20excellent%20intro%20to%20Graph%20-%20which%2C%20to%20be%20frank%20I'd%20never%20heard%20of%2030mins%20ago%20-%20now%20I%20can%20copy%20profiles%20without%20any%20Powershell%20rabbit%20holes%20-%20but%20honestly%20why%20it%20isn't%20in%20the%20GUI%2C%20we%20will%20never%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWell%20done%20and%20thanks%3C%2FP%3E%3CP%3EStu%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-784152%22%20slang%3D%22en-US%22%3ERe%3A%20Duplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-784152%22%20slang%3D%22en-US%22%3EI%20agree%2C%20it's%20a%20simple%20thing%20that%20should%20be%20a%20click%20away%20and%20I'm%20sure%20it%20will%20be%20in%20time.%20Graph%20is%20pretty%20powerful.%20As%20you%20said%2C%20this%20was%20just%20an%20intro%20into%20what%20you%20can%20do%20with%20it.%20There%20are%20other%20tasks%20that%20I%20do%20in%20Graph%20that%20will%20probably%20never%20be%20available%20in%20GUI%2C%20just%20because%20there%20isn't%20much%20demand%20for%20it%20so%20it's%20a%20good%20skill%20to%20have%20in%20your%20back-pocket%20and%20not%20have%20to%20worry%20about%20PS%20gotchas.%3CBR%20%2F%3E%3CBR%20%2F%3EGlad%20it%20helped!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785526%22%20slang%3D%22en-US%22%3ERe%3A%20Duplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785526%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F363069%22%20target%3D%22_blank%22%3E%40JayWilliams%3C%2FA%3E%26nbsp%3Bwrote%3A%3CBR%20%2F%3E%3CP%3ELucky%20us%2C%20the%20entire%20Intune%20UI%20front%20end%20is%20built%20using%20Graph%20so%20anything%20we%20can%20do%20in%20the%20UI%2C%20we%20can%20also%20do%20in%20Graph.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3EWell%2C%20much%20of%20it.%20But%20not%20all.%3CBR%20%2F%3EYou%20can%20do%20everything%20you%20do%20in%20UI%20by%20automation%2C%20but%20not%20necessary%20with%20Graph%20API.%3CBR%20%2F%3EConditional%20Access%20is%20controlled%20by%20the%20API%26nbsp%3Bmain.iam.ad.ext.azure.com%3CBR%20%2F%3EHaven't%20found%20any%20official%20documentation%20for%20that%20API%2C%20so%20probably%20not%20ment%20for%20public%20usage%20and%20possibly%20unsupported%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785884%22%20slang%3D%22en-US%22%3ERe%3A%20Duplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785884%22%20slang%3D%22en-US%22%3EYou're%20right!%20I%20totally%20forgot%20about%20that%20API.%3CBR%20%2F%3EIf%20I%20remember%20correctly%2C%20I%20ran%20across%20it%20when%20trying%20to%20do%20some%20dynamic%20group%20work%20but%20didn't%20spend%20too%20much%20time%20in%20there.%20Thanks%20for%20the%20heads%20up.%20I'll%20edit%20the%20post%20and%20I'll%20try%20to%20tread%20lightly%20in%20that%20API.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-772774%22%20slang%3D%22en-US%22%3EDuplicating%20Device%20Configuration%20Profiles%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-772774%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22toc-hId-1990771591%22%20id%3D%22toc-hId-1990771591%22%3EDuplicating%20Device%20Configuration%20Profiles%3C%2FH1%3E%3CH6%20id%3D%22toc-hId--1543952895%22%20id%3D%22toc-hId--1543952895%22%3E7%2F24%2F2019%20-%2013%20Minutes%20to%20read%3C%2FH6%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20of%20the%20highest%20voted%20feature%20requests%20in%20Intune%20UserVoice%20is%20the%20ability%20to%20duplicate%20Device%20Configuration%20profiles%20and%20for%20good%20reason.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20work%20in%20the%20Education%20sector%2C%20so%20I'm%20deploying%20carts%20of%20laptops%20to%20multiple%20classrooms%20in%20multiple%20schools.%20Generally%2C%20the%20whole%20school%20would%20have%20the%20same%20profiles%20assigned%20to%20all%20devices%20but%20teachers%20can%20be%20pretty%20fickle%20about%20what%20restrictions%20should%20and%20shouldn't%20be%20on%20their%20classroom's%20devices.%20So%20if%20a%20couple%20classrooms%20want%20to%20have%20one%20or%20two%20things%20changed%20for%20their%20carts%2C%20I'd%20be%20stuck%20in%20the%20portal%2C%20clicking%20away%20and%20comparing%20until%20I%20have%20four%20or%20five%20profiles%20that%20are%20exactly%20the%20same%2C%20aside%20from%20those%20tiny%20changes.%20It's%20a%20huge%20time%20suck%20having%20to%20do%20that%20and%20some%20setting%20always%20gets%20missed.%20Lucky%20us%2C%20(almost*)%20the%20entire%20Intune%20UI%20front%20end%20is%20built%20using%20Graph%20so%20anything%20we%20can%20do%20in%20the%20UI%2C%20we%20can%20also%20do%20in%20Graph.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet's%20say%20that%20the%20entire%20school%20has%20a%20profile%20applied%20to%20all%20devices%20but%20one%20classroom%20wants%20to%20block%20the%20camera.%20To%20do%20this%20through%20the%20UI%2C%20we'd%20have%20to%20start%20from%20scratch%20and%20dual%20monitor%20or%20split%20screen%20two%20windows%20to%20have%20the%20default%20profile%20open%20while%20we%20configure%20the%20one-off%20profile.%20But%20let's%20see%20how%20we%20can%20do%20this%20through%20Graph%20to%20speed%20up%20the%20process%20and%20help%20eliminate%20missed%20settings%20between%20the%20two%20profiles.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20use%20two%20methods%20to%20view%20the%20profile%20through%20Graph.%20Between%20the%20two%2C%20the%20one%20that%20I%20use%20just%20depends%20on%20if%20I%20have%20Graph%20open%20already.%20If%20I%20don't%20have%20Graph%20open%2C%20I'll%20start%20in%20the%20portal.%20We'll%20start%20with%20that%20method%20first.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId-984911460%22%20id%3D%22toc-hId-984911460%22%3EMethod%201%20%E2%80%93%20Using%20Developer%20Tools%20from%20your%20Browser%3C%2FH2%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20first%20method%2C%20you'll%20be%20using%20your%20browser's%20built-in%20Developer%20Tools.%20For%20me%2C%20that's%20usually%20Chrome%20but%20I've%20been%20using%20the%20new%20Edge%20more%20and%20more%20lately.%20The%20good%20thing%20is%20since%20they%20are%20both%20built%20on%20Chromium%2C%20it's%20pretty%20much%20the%20same%20between%20the%20two.%20For%20this%20guide%2C%20I'll%20be%20using%20Chrome.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENavigate%20to%20Intune%20%26gt%3B%20Device%20configuration%20%E2%80%93%20Profiles%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124396i79A63DFDF7C3D112%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%203.44.36%20PM%201.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%203.44.36%20PM%201.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESince%20everything%20in%20the%20UI%20is%20just%20a%20frontend%20for%20Graph%20API%2C%20every%20time%20you%20do%20something%20in%20the%20UI%2C%20you'll%20be%20able%20to%20see%20all%20of%20the%20REST%20requests%20made%20by%20observing%20Network%20requests%20from%20the%20Network%20tab%20of%20your%20DevTools.%20This%20can%20look%20a%20little%20intimidating%20at%20first%20but%20if%20you%20start%20recording%20Network%20requests%20right%20before%20you%20view%20or%20change%20something%20in%20the%20UI%2C%20then%20stop%20recording%20when%20you're%20done%20viewing%20or%20changing%20things%2C%20you'll%20limit%20the%20number%20of%20recorded%20requests%20to%20only%20what%20happened%20while%20you%20making%20the%20changes%20or%20viewing%20the%20profiles.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOpen%20your%20browser's%20Developer%20Tools.%20In%20Chrome%20(called%20DevTools)%2C%20this%20is%20done%20by%20pushing%20F12.%20Open%20the%20Network%20tab%20and%20make%20sure%20it's%20recording.%20You'll%20see%20the%20Red%20record%20button%20lit%20up.%3C%2FP%3E%3CP%3EClick%20on%20the%20profile%20you%20want%20to%20copy.%20Once%20the%20page%20loads%2C%20stop%20the%20Network%20recording.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20should%20now%20see%20a%20handful%20of%20requests%20listed%20there.%20These%20are%20what%20was%20happening%20behind%20the%20scenes%20as%20you%20opened%20the%20profile%20that%20you%20wanted%20to%20copy.%20We%20can%20break%20this%20down%20a%20little%20bit%20but%20we%20won't%20get%20too%20deep%20as%20that%20could%20be%20a%20completely%20separate%20guide%20by%20itself%20and%20I'm%20not%20an%20expert%20in%20RESTful%20APIs.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124400iDFBAE9367DA7A1F6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%203.45.19%20PM%201.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%203.45.19%20PM%201.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20see%20a%20little%20bit%20of%20what%20you%20need%20just%20by%20the%20name%20of%20the%20requests%2C%20but%20when%20you%20click%20on%20the%20requests%2C%20you'll%20get%20a%20lot%20more%20information.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EClick%20on%20the%20first%20one%20listed%20and%20open%20the%20Headers%20tab.%20In%20that%20tab%2C%20you'll%20see%20Request%20URL%20under%20General.%20Let's%20take%20a%20look%20at%20that%20URL%20and%20break%20it%20down.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124415iCDBA8F784BAD567D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%204.09.00%20PM.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%204.09.00%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20case%2C%20it%20can%20be%20broken%20down%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2F%257bversion%257d%2F%257bcollection%257d%2F%257bcollection%257d%2F%257bentity%257d%3F%255bquery_parameters%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2F%7Bversion%7D%2F%7Bcollection%7D%2F%7Bcollection%7D%2F%7Bentity%7D%3F%5Bquery_parameters%3C%2FA%3E%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20that%20means%2C%20%22deviceManagment%22%20is%20a%20collection%20that%20contains%20other%20collections%2C%20like%20%22managedDeviceOverview%22%2C%20%22detectedApps%22%2C%20and%20what%20we%20want%2C%20%22deviceConfigurations%22.%20%22deviceConfigurations%22%20is%20the%20collection%20of%2C%20you%20guessed%20it%2C%20all%20your%20device%20configuration%20profiles.%20And%20the%20final%20part%20of%20the%20request%20URL%20is%20the%20ID%20of%20the%20device%20configuration%20profile%20entity%20that%20we%20are%20copying.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20technically%2C%20that%20is%20the%20full%20URL.%20The%20question%20mark%20is%20the%20query%20initiator%20and%20everything%20after%20is%20part%20of%20the%20query.%20In%20our%20URL%2C%20the%20query%20is%20requesting%20that%20the%20returned%20data%20also%20includes%20the%20assignments%20of%20the%20profile.%20We%20don't%20really%20need%20that%20and%20it's%20usually%20faster%20to%20just%20do%20the%20assignments%20through%20the%20UI%20unless%20you%20already%20have%20the%20entity%20ID%20of%20the%20groups%20you%20will%20be%20assigning%20them%20to.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124414i0CBE58AE06A36CAB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%204.05.54%20PM.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%204.05.54%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20now%20that%20we%20know%20all%20that%2C%20we%20can%20move%20on%20to%20the%20next%20Network%20request%20in%20the%20list%20which%20should%20be%20the%20actual%20%22GET%22%20request.%20What%20we%20are%20interested%20in%20with%20this%20one%2C%20is%20in%20the%20Response%20tab.%20These%20are%20all%20the%20settings%20that%20are%20in%20that%20device%20configuration%20profile%20and%20all%20their%20properties.%20Now%2C%20in%20this%20view%20it's%20pretty%20hard%20to%20read%2C%20but%20we%20can%20use%20Graph%20Explorer%20to%20get%20the%20same%20data%20in%20a%20prettier%20format%20since%20we%20have%20the%20request%20URL.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECopy%20everything%20in%20the%20Request%20URL%20from%20the%20beginning%20up%20to%20the%20%22%3F%22.%20Remember%20that%20the%20question%20mark%20and%20everything%20behind%20it%20is%20part%20of%20a%20query%20and%20is%20not%20something%20that%20we%20need%20right%20now.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOpen%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%3C%2FA%3E%23%20in%20a%20browser%2C%20sign%20in%2C%20and%20read%20and%20allow%20access%20if%20needed%20(if%20this%20is%20your%20first%20time%20using%20Graph%20and%20no%20one%20has%20accepted%20on%20behalf%20of%20the%20organization%20then%20you'll%20be%20prompted%20for%20this).%3C%2FP%3E%3CP%3EIn%20the%20Graph%20URL%20request%20input%20field%2C%20paste%20the%20Request%20URL%20that%20you%20just%20copied.%20Make%20sure%20that%20the%20HTTP%20verb%20select%20button%20is%20on%20GET%20and%20click%20on%20Run%20Query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUpon%20success%20you'll%20get%20a%20little%20notification%20with%20the%20Status%20Code%20of%20200%20and%20a%20Response%20Preview%20of%20all%20the%20settings%20and%20their%20properties%20in%20JSON%20format.%20We%20now%20have%20all%20the%20data%20we%20need%20to%20make%20another%20profile%20with%20the%20exact%20same%20settings.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124404i96128F2B5300498C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%203.47.04%20PM%201.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%203.47.04%20PM%201.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1567245501%22%20id%3D%22toc-hId--1567245501%22%3EMethod%202%20%E2%80%93%20Using%20Graph%20to%20find%20the%20device%20configuration%20profile%3C%2FH2%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20second%20method%20is%20actually%20the%20one%20I%20use%20most%20since%20I%20typically%20have%20a%20Graph%20Explorer%20window%20open%20as%20one%20of%20my%20five%20opening%20tabs%20and%20since%20I'm%20becoming%20more%20comfortable%20using%20Graph.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOpen%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%3C%2FA%3E%23%20in%20a%20browser%20and%20enter%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FdeviceManagement%2FdeviceConfigurations%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FdeviceManagement%2FdeviceConfigurations%3C%2FA%3Einto%20the%20Graph%20URL%20request%20input%20field%2C%20make%20sure%20that%20the%20HTTP%20verb%20select%20button%20is%20on%20GET%20and%20click%20on%20Run%20Query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124421i413FF7F98B9B8225%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Untitled%20picture.png%22%20title%3D%22Untitled%20picture.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20I%20know%20this%20if%20I%20didn't%20use%20DevTools%3F%20The%20%22Working%20with%20Intune%20in%20Microsoft%20Graph%22%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fintune-graph-overview%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fresources%2Fintune-graph-overview%3Fview%3Dgraph-rest-1.0%3C%2FA%3E)%20doc%20is%20a%20pretty%20great%20reference%20on%20how%20to%20navigate%20your%20way%20through%20Graph.%20I%20have%20come%20across%20a%20few%20discrepancies%20here%20and%20there%20but%20for%20the%20most%20part%2C%20it's%20pretty%20solid.%20Using%20that%20doc%2C%20you%20can%20find%20out%20how%20to%20%22list%22%20all%20your%20device%20configurations.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAgain%2C%20you%20should%20see%20%22Success%20%E2%80%93%20Status%20Code%20200%22%20after%20the%20query%20is%20returned.%20This%20time%2C%20in%20the%20Response%20Preview%20body%2C%20you'll%20see%20a%20list%20of%20all%20your%20device%20configuration%20profiles.%20For%20me%2C%20it's%20a%20very%20short%20list%3B%20just%20one%20profile%2C%20but%20in%20a%20production%20environment%2C%20there%20can%20be%20a%20lot%20more.%20Easiest%20thing%20to%20do%20is%20ctrl-F%20to%20find%20the%20name%20of%20the%20profile%20you%20want%20to%20copy%20but%20you%20can%20save%20yourself%20a%20little%20time%20and%20get%20a%20little%20practice%20in%20by%20adding%20some%20query%20parameters%20to%20the%20end%20of%20your%20request%20URL.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20initiate%20the%20query%20parameter%20with%20%22%3F%22%20Followed%20by%20the%20name%20of%20the%20parameter.%20These%20query%20options%20are%20in%20OData%20V4%20query%20language.%20We'll%20be%20using%20the%20%22%24filter%22%20to%20filter%20out%20everything%20we%20don't%20need%20and%20only%20return%20what%20we%20do%20need.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20you%20can%20see%20in%20the%20screen%20shot%2C%20the%20%22displayName%22%20of%20my%20policy%20is%20%22Default%20Restrictions%22.%20Since%20we%20already%20know%20the%20name%20of%20the%20policy%20we%20are%20going%20to%20be%20copying%2C%20we%20can%20use%20that%20to%20filter%20everything%20else%20out%20by%20adding%20%3F%24filter%3DdisplayName%20eq%20'Default%20Restrictions'%26nbsp%3B%20to%20the%20end%20of%20our%20request%20URL%20and%20run%20the%20query.%20Now%2C%20only%20profiles%20matching%20that%20filter%20will%20be%20returned.%20Then%20copy%20the%20%22id%22%2C%20and%20add%20it%20to%20the%20end%20of%20the%20request%20URL%20and%20run%20your%20query%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124407iC4F35C9447B6A334%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%203.47.52%20PM.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%203.47.52%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20now%20have%20the%20data%20we%20need%20to%20create%20a%20new%20profile%20with%20the%20same%20settings.%3C%2FP%3E%3CH2%20id%3D%22toc-hId-175564834%22%20id%3D%22toc-hId-175564834%22%3ECreating%20the%20new%20profile%3C%2FH2%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20should%20now%20be%20looking%20at%20a%20JSON%20formatted%20policy%20that%20we%20can%20copy%20and%20edit%20to%20create%20a%20new%20policy%20with.%20To%20do%20this%2C%20we'll%20need%20to%20prune%20out%20a%20few%20lines.%20While%20you%20can%20do%20this%20directly%20in%20Graph%20Explorer%2C%20I%20recommend%20using%20a%20smart%20text%20editor%20like%20Notepad%20%2B%2B%20or%20Sublime%20Text.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECopy%20everything%20from%20the%20opening%20bracket%20(%20%7B%20)%20just%20above%20the%20%22%40odata.context%22%20line%20to%20the%20closing%20bracket%20(%20%7D%20)%20just%20after%20your%20last%20setting.%20Careful%20here.%20You%20have%20to%20make%20sure%20you're%20copying%20everything%20you%20need.%20In%20my%20profile%2C%20the%20last%20setting%20uses%20brackets%20within%20the%20setting.%20It's%20easy%20to%20misread%20it%20and%20copy%20the%20bracket%20that%20closes%20that%20setting%20and%20miss%20the%20bracket%20the%20closes%20the%20entire%20config.%20Just%20be%20mindful%20of%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPaste%20the%20copied%20text%20into%20a%20text%20editor%20and%20find%20the%20lines%20that%20you'll%20need%20to%20delete.%20You'll%20want%20to%20remove%20anything%20that%20is%20generated%20automatically%20like%20%22%40odata.context%22%2C%20%22id%22%2C%20%22lastModifiedDateTime%22%2C%26nbsp%3B%20%22supportsScopeTags%22%2C%20%22createdDateTime%22%2C%20and%20%22version%22.%20Once%20those%20are%20removed%2C%20you'll%20want%20to%20edit%20the%20%22displayName%22%20and%20%22description%22%20at%20least%2C%20but%20you%20can%20also%20make%20your%20configuration%20changes%20here%20if%20you%20know%20what%20you%20are%20doing.%20In%20my%20case%2C%20I'll%20change%20the%20%22displayName%22%2C%20%22description%22%2C%20and%20%22cameraBlocked%22%20settings%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20first%20two%20setting%20properties%20are%20strings%2C%20while%20the%20%22cameraBlocked%22%20setting%20property%20is%20boolean.%20I'll%20replace%20displayName%3A%20%22Default%20Restrictions%22%20with%20%22Custom%20Restrictions%20%E2%80%93%20City%20High%20School%20Room%20104%22%2C%20description%3A%20%22Standard%20policy%20for%20Company%20Windows%2010%20Devices%22%20with%20%22Modified%20from%20Default%20Restrictions%20%E2%80%93%20Block%20Camera%22%2C%20and%20cameraBlocked%3A%20false%20to%20true.%20Pay%20special%20attention%20to%20where%20the%20quotes%20are.%20There%20are%20none%20needed%20for%20boolean%20properties.%20Now%20I%20have%20my%20new%20profile%20in%20JSON%20format%20and%20we%20are%20ready%20to%20create%20the%20new%20profile%20using%20Graph.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124417iD98BAAE38AB84F47%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%204.18.15%20PM.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%204.18.15%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOpen%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fgraph%2Fgraph-explorer%3C%2FA%3Eand%20enter%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FdeviceManagement%2FdeviceConfigurations%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2FdeviceManagement%2FdeviceConfigurations%3C%2FA%3Ein%20the%20URL%20request%20field.%20Copy%20and%20paste%20our%20newly%20created%20JSON%20text%20into%20the%20Request%20Body%20field%2C%20change%20the%20HTTP%20verb%20select%20button%20to%20POST%2C%20run%20our%20query%20and%20be%20done.%20Obviously%2C%20you%20always%20want%20to%20be%20very%20careful%20when%20you%20are%20running%20POST%20requests%2C%20and%20generally%20any%20other%20request%20that%20isn't%20a%20read%20action.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20should%20now%20get%20a%20notification%20with%20%22Success%20%E2%80%93%20Status%20Code%20201%22%20along%20with%20a%20Response%20Preview%20of%20the%20complete%20JSON%20data%20of%20the%20new%20profile%2C%20including%20the%20automatically%20created%20settings%20that%20were%20removed%20previously.%20If%20you%20refresh%20your%20Intune%20%26gt%3B%20Device%20configuration%20%E2%80%93%20Profiles%20blade%2C%20you'll%20see%20your%20new%20profile.%20It's%20always%20best%20to%20compare%20the%20number%20of%20Settings%20Configured%20just%20to%20be%20sure%20nothing%20was%20missed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124413i48EC09428AD4FB9B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%203.50.36%20PM.png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%203.50.36%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20you%20can%20see%20that%20the%20new%20profile%20has%20the%20correct%20name%2C%20description%2C%20and%20has%20one%20more%20setting%20then%20the%20Default%20Restrictions%20profile.%20That%20additional%20setting%20is%20the%20Block%20Camera%20setting.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124418iBBF44E88B6183261%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Screen%20Shot%202019-07-24%20at%204.24.09%20PM%20(2).png%22%20title%3D%22Screen%20Shot%202019-07-24%20at%204.24.09%20PM%20(2).png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20you%20can%20see%20how%20we%20can%20leverage%20Graph%20to%20programmatically%20make%20changes%20to%20Intune.%20It%20doesn't%20stop%20with%20duplicating%20profiles%20either.%20I've%20used%20it%20to%20create%20hundreds%20of%20Dynamic%20Device%20Groups%2C%20assign%20Apps%20to%20mass%20groups%2C%20and%20much%20more.%20Graph%20is%20adding%20to%20its%20capabilities%20to%20manage%20Intune%20as%20fast%20as%20Intune%20is%20adding%20features.%20And%20best%20of%20all%2C%20you%20get%20to%20deal%20with%20Intune%20UI%20a%20lot%20less.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFollow%20Graph's%20What's%20new%20page%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fwhats-new-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fwhats-new-overview%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFollow%20me%20on%20Twitter%3A%26nbsp%3B%40portaldotjay%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E*%20-Thanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F364308%22%20target%3D%22_blank%22%3E%40jenstf%3C%2FA%3E%26nbsp%3B%20for%20pointing%20out%20that%20Intune%20also%20uses%20the%20API%2C%20%22%3CSPAN%3Emain.iam.ad.ext.azure.com%22.%20Be%20warned%20-%20using%20that%20API%20is%20unsupported%20so%20don't%20dink%20around%20in%20there%20if%20you%20don't%20know%20what%20you're%20doing.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-772774%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EGraph%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIntune%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Device%20Management%20(MDM)%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
JayWilliams
New Contributor

Duplicating Device Configuration Profiles

7/24/2019 - 13 Minutes to read

 

One of the highest voted feature requests in Intune UserVoice is the ability to duplicate Device Configuration profiles and for good reason.

 

I work in the Education sector, so I'm deploying carts of laptops to multiple classrooms in multiple schools. Generally, the whole school would have the same profiles assigned to all devices but teachers can be pretty fickle about what restrictions should and shouldn't be on their classroom's devices. So if a couple classrooms want to have one or two things changed for their carts, I'd be stuck in the portal, clicking away and comparing until I have four or five profiles that are exactly the same, aside from those tiny changes. It's a huge time suck having to do that and some setting always gets missed. Lucky us, (almost*) the entire Intune UI front end is built using Graph so anything we can do in the UI, we can also do in Graph.

 

Let's say that the entire school has a profile applied to all devices but one classroom wants to block the camera. To do this through the UI, we'd have to start from scratch and dual monitor or split screen two windows to have the default profile open while we configure the one-off profile. But let's see how we can do this through Graph to speed up the process and help eliminate missed settings between the two profiles.

 

I use two methods to view the profile through Graph. Between the two, the one that I use just depends on if I have Graph open already. If I don't have Graph open, I'll start in the portal. We'll start with that method first.

 

Method 1 – Using Developer Tools from your Browser

 

The first method, you'll be using your browser's built-in Developer Tools. For me, that's usually Chrome but I've been using the new Edge more and more lately. The good thing is since they are both built on Chromium, it's pretty much the same between the two. For this guide, I'll be using Chrome.

 

Navigate to Intune > Device configuration – Profiles

 

Screen Shot 2019-07-24 at 3.44.36 PM 1.png

 

Since everything in the UI is just a frontend for Graph API, every time you do something in the UI, you'll be able to see all of the REST requests made by observing Network requests from the Network tab of your DevTools. This can look a little intimidating at first but if you start recording Network requests right before you view or change something in the UI, then stop recording when you're done viewing or changing things, you'll limit the number of recorded requests to only what happened while you making the changes or viewing the profiles.

 

Open your browser's Developer Tools. In Chrome (called DevTools), this is done by pushing F12. Open the Network tab and make sure it's recording. You'll see the Red record button lit up.

Click on the profile you want to copy. Once the page loads, stop the Network recording.

 

You should now see a handful of requests listed there. These are what was happening behind the scenes as you opened the profile that you wanted to copy. We can break this down a little bit but we won't get too deep as that could be a completely separate guide by itself and I'm not an expert in RESTful APIs.

 

Screen Shot 2019-07-24 at 3.45.19 PM 1.png

 

You can see a little bit of what you need just by the name of the requests, but when you click on the requests, you'll get a lot more information.

 

Click on the first one listed and open the Headers tab. In that tab, you'll see Request URL under General. Let's take a look at that URL and break it down.

 

Screen Shot 2019-07-24 at 4.09.00 PM.png

 

In this case, it can be broken down like this:

 

https://graph.microsoft.com/{version}/{collection}/{collection}/{entity}?[query_parameters]

 

So that means, "deviceManagment" is a collection that contains other collections, like "managedDeviceOverview", "detectedApps", and what we want, "deviceConfigurations". "deviceConfigurations" is the collection of, you guessed it, all your device configuration profiles. And the final part of the request URL is the ID of the device configuration profile entity that we are copying.

 

Now technically, that is the full URL. The question mark is the query initiator and everything after is part of the query. In our URL, the query is requesting that the returned data also includes the assignments of the profile. We don't really need that and it's usually faster to just do the assignments through the UI unless you already have the entity ID of the groups you will be assigning them to.

 

Screen Shot 2019-07-24 at 4.05.54 PM.png

 

So now that we know all that, we can move on to the next Network request in the list which should be the actual "GET" request. What we are interested in with this one, is in the Response tab. These are all the settings that are in that device configuration profile and all their properties. Now, in this view it's pretty hard to read, but we can use Graph Explorer to get the same data in a prettier format since we have the request URL.

 

Copy everything in the Request URL from the beginning up to the "?". Remember that the question mark and everything behind it is part of a query and is not something that we need right now.

 

Open https://developer.microsoft.com/en-us/graph/graph-explorer# in a browser, sign in, and read and allow access if needed (if this is your first time using Graph and no one has accepted on behalf of the organization then you'll be prompted for this).

In the Graph URL request input field, paste the Request URL that you just copied. Make sure that the HTTP verb select button is on GET and click on Run Query.

 

Upon success you'll get a little notification with the Status Code of 200 and a Response Preview of all the settings and their properties in JSON format. We now have all the data we need to make another profile with the exact same settings.

 

Screen Shot 2019-07-24 at 3.47.04 PM 1.png

Method 2 – Using Graph to find the device configuration profile

 

The second method is actually the one I use most since I typically have a Graph Explorer window open as one of my five opening tabs and since I'm becoming more comfortable using Graph.

 

Open https://developer.microsoft.com/en-us/graph/graph-explorer# in a browser and enter https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations into the Graph URL request input field, make sure that the HTTP verb select button is on GET and click on Run Query.

 

Untitled picture.png

 

How do I know this if I didn't use DevTools? The "Working with Intune in Microsoft Graph" (https://docs.microsoft.com/en-us/graph/api/resources/intune-graph-overview?view=graph-rest-1.0) doc is a pretty great reference on how to navigate your way through Graph. I have come across a few discrepancies here and there but for the most part, it's pretty solid. Using that doc, you can find out how to "list" all your device configurations.

 

Again, you should see "Success – Status Code 200" after the query is returned. This time, in the Response Preview body, you'll see a list of all your device configuration profiles. For me, it's a very short list; just one profile, but in a production environment, there can be a lot more. Easiest thing to do is ctrl-F to find the name of the profile you want to copy but you can save yourself a little time and get a little practice in by adding some query parameters to the end of your request URL.

 

We initiate the query parameter with "?" Followed by the name of the parameter. These query options are in OData V4 query language. We'll be using the "$filter" to filter out everything we don't need and only return what we do need.

 

As you can see in the screen shot, the "displayName" of my policy is "Default Restrictions". Since we already know the name of the policy we are going to be copying, we can use that to filter everything else out by adding ?$filter=displayName eq 'Default Restrictions'  to the end of our request URL and run the query. Now, only profiles matching that filter will be returned. Then copy the "id", and add it to the end of the request URL and run your query again.

 

Screen Shot 2019-07-24 at 3.47.52 PM.png

 

We now have the data we need to create a new profile with the same settings.

Creating the new profile

 

We should now be looking at a JSON formatted policy that we can copy and edit to create a new policy with. To do this, we'll need to prune out a few lines. While you can do this directly in Graph Explorer, I recommend using a smart text editor like Notepad ++ or Sublime Text.

 

Copy everything from the opening bracket ( { ) just above the "@odata.context" line to the closing bracket ( } ) just after your last setting. Careful here. You have to make sure you're copying everything you need. In my profile, the last setting uses brackets within the setting. It's easy to misread it and copy the bracket that closes that setting and miss the bracket the closes the entire config. Just be mindful of that.

 

Paste the copied text into a text editor and find the lines that you'll need to delete. You'll want to remove anything that is generated automatically like "@odata.context", "id", "lastModifiedDateTime",  "supportsScopeTags", "createdDateTime", and "version". Once those are removed, you'll want to edit the "displayName" and "description" at least, but you can also make your configuration changes here if you know what you are doing. In my case, I'll change the "displayName", "description", and "cameraBlocked" settings,

 

The first two setting properties are strings, while the "cameraBlocked" setting property is boolean. I'll replace displayName: "Default Restrictions" with "Custom Restrictions – City High School Room 104", description: "Standard policy for Company Windows 10 Devices" with "Modified from Default Restrictions – Block Camera", and cameraBlocked: false to true. Pay special attention to where the quotes are. There are none needed for boolean properties. Now I have my new profile in JSON format and we are ready to create the new profile using Graph.

 

Screen Shot 2019-07-24 at 4.18.15 PM.png

 

Open https://developer.microsoft.com/en-us/graph/graph-explorer and enter https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations in the URL request field. Copy and paste our newly created JSON text into the Request Body field, change the HTTP verb select button to POST, run our query and be done. Obviously, you always want to be very careful when you are running POST requests, and generally any other request that isn't a read action. 

 

You should now get a notification with "Success – Status Code 201" along with a Response Preview of the complete JSON data of the new profile, including the automatically created settings that were removed previously. If you refresh your Intune > Device configuration – Profiles blade, you'll see your new profile. It's always best to compare the number of Settings Configured just to be sure nothing was missed.

 

Screen Shot 2019-07-24 at 3.50.36 PM.png

 

Here you can see that the new profile has the correct name, description, and has one more setting then the Default Restrictions profile. That additional setting is the Block Camera setting.

 

Screen Shot 2019-07-24 at 4.24.09 PM (2).png

 

 

So you can see how we can leverage Graph to programmatically make changes to Intune. It doesn't stop with duplicating profiles either. I've used it to create hundreds of Dynamic Device Groups, assign Apps to mass groups, and much more. Graph is adding to its capabilities to manage Intune as fast as Intune is adding features. And best of all, you get to deal with Intune UI a lot less.

 

Follow Graph's What's new page at https://docs.microsoft.com/en-us/graph/whats-new-overview.

 

Follow me on Twitter: @portaldotjay

 

* -Thanks @jenstf  for pointing out that Intune also uses the API, "main.iam.ad.ext.azure.com". Be warned - using that API is unsupported so don't dink around in there if you don't know what you're doing. 

6 Replies

Hey @JayWilliams,

 

there is also the option to use some PowerShell code provides by MS for this:

In the PowerShell Intune Samples you have functional scripts for Export/Import of Device Configurations, see here: https://github.com/microsoftgraph/powershell-intune-samples/tree/master/DeviceConfiguration

 

best,
Oliver

@Oliver Kieselbach Thanks! I'm sure those work just as well. This was a good opportunity to show the power of using the Graph API.

A benefit for me using this vs PowerShell is not having an environment to maintain. Probably doesn't matter if using Cloud Shell but never hurts to know more than one way to skin the cat. 

@JayWilliams 

This was an excellent intro to Graph - which, to be frank I'd never heard of 30mins ago - now I can copy profiles without any Powershell rabbit holes - but honestly why it isn't in the GUI, we will never know.

 

Well done and thanks

Stu

I agree, it's a simple thing that should be a click away and I'm sure it will be in time. Graph is pretty powerful. As you said, this was just an intro into what you can do with it. There are other tasks that I do in Graph that will probably never be available in GUI, just because there isn't much demand for it so it's a good skill to have in your back-pocket and not have to worry about PS gotchas.

Glad it helped!

 


@JayWilliams wrote:

Lucky us, the entire Intune UI front end is built using Graph so anything we can do in the UI, we can also do in Graph.

 

Well, much of it. But not all.
You can do everything you do in UI by automation, but not necessary with Graph API.
Conditional Access is controlled by the API main.iam.ad.ext.azure.com
Haven't found any official documentation for that API, so probably not ment for public usage and possibly unsupported? 

 

You're right! I totally forgot about that API.
If I remember correctly, I ran across it when trying to do some dynamic group work but didn't spend too much time in there. Thanks for the heads up. I'll edit the post and I'll try to tread lightly in that API.
Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
7 Replies