Forum Discussion

kcelmer's avatar
kcelmer
Copper Contributor
Apr 15, 2025

Get-MgDeviceAppManagementManagedAppPolicy -ManagedAppPolicyID. How to get the ID?

Hello!

I am trying to copy an Intune App Protection Policy so I can edit it and apply it to a different group of users.  I've cobbled together the below script from other examples but it doesn't work because I am not able to find the -ManagedAppPolicyID that it wants.  I've not been able to find it anywhere in Intune.  I've not been able to find a PowerShell cmdlet that will list it either. Does anyone know how I can make this work?  Or another way to do it?

 

Install-Module Microsoft.Graph -Scope CurrentUser

Connect-MgGraph -Scopes "DeviceManagementApps.ReadWrite.All"

$policyId = "<Insert App Policy ID>"

$appProtectionPolicy = Get-MgDeviceAppManagementManagedAppPolicy -ManagedAppPolicyId $policyId

    $newPolicy = $appProtectionPolicy | Select-Object * -ExcludeProperty Id, CreatedDateTime, Version, LastModifiedDateTime

    $newPolicy.DisplayName = "Copy of $($newPolicy.DisplayName)"

New-MgDeviceAppManagementMobileAppConfiguration -Data $newPolicy

Get-MgDeviceAppManagementManagedAppPolicy -Filter "displayName eq '$($newPolicy.DisplayName)'"

  • Managed Policy ID you can find it when you go to the policy it self then in Overview> check the URL you will find the policy ID. 

      

    Best,  

    Ahmed Masoud  

    LinkedIn

    • kcelmer's avatar
      kcelmer
      Copper Contributor

      Thank you!  Found it. Unfortunately it now errors out on Line 7 with

      "New-MgDeviceAppManagementMobileAppConfiguration: C:\Users\kcelmer\OneDrive - National Resident Matching Program\Documents\PowerShell Scripts\Copy Intune App Protection Policy.ps1:7:49
      Line |
         7 |  New-MgDeviceAppManagementMobileAppConfiguration -Data $newPolicy
           |                                                  ~~~~~
           | A parameter cannot be found that matches parameter name 'Data'."

       

      Apparently -Data is not a valid parameter. AI generated scripts....

Resources