You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bulk delete tool is simply fantastic! I did find one scenario where it is failing to delete types of Intune objects which is for Autopilot profiles.
Shown below is an example of duplicate Autopilot profiles:
When I select some of the duplicates and proceed, they are not deleted, and I get these error messages:
Installing Microsoft Graph modules if required (current user scope)
Microsoft Graph Already Installed
Version 2 module detected
Connected to Intune tenant
20dd3f34-d210-423d-93c5-fa0412b41b05
It's an Autopilot Profile
Invoke-MgGraphRequest : DELETE https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/20dd3f34-d210-423d-93c5-fa0412b41b05
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: 4b058a4d-a784-41c7-95ed-b83996791a7e
client-request-id: cb37c5a5-2535-49f4-9c79-1668688b25c2
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Central US","Slice":"E","Ring":"2","ScaleUnit":"000","RoleInstance":"CY4PEPF00013268"}}
Date: Mon, 16 Dec 2024 15:27:43 GMT
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"BadRequest","message":"{\r\n "_version": 3,\r\n "Message": "An error has occurred - Operation ID (for customer support):
00000000-0000-0000-0000-000000000000 - Activity ID: cb37c5a5-2535-49f4-9c79-1668688b25c2 - Url: https://fef.amsua0102.manage.microsoft.com/DeviceEn
rollmentFE/StatelessDeviceEnrollmentFEService/deviceManagement/windowsAutopilotDeploymentProfiles('20dd3f34-d210-423d-93c5-fa0412b41b05')?api-versi
on=5023-06-28",\r\n "CustomApiErrorPhrase": "",\r\n "RetryAfter": null,\r\n "ErrorSourceService": "",\r\n "HttpHeaders": "{}"\r
n}","innerError":{"date":"2024-12-16T15:27:43","request-id":"4b058a4d-a784-41c7-95ed-b83996791a7e","client-request-id":"cb37c5a5-2535-49f4-9c79-166
8688b25c2"}}}
At C:\Users\ricke\Documents\files\My Documents\Security and Compliance\Azure AD\scripts\Bulk delete Intune configs.ps1:1339 char:16
Hi Rick,
Check if the profiles are assigned, Autopilot profiles won't delete if they have assignments (even in the UI). It's caught me out a few times :)
@andrew-s-taylor You were right! I have been using a tool to migrate Intune policies from one Azure tenant to another and it had a bug which has been creating extensive duplicates of some policies and profiles like this Autopilot profile which unfortunately has an assignment to it. So, I guess I need to manually remove all of the assignments then I could use your poulk tool to remove those dupes. Thank you.
This bulk delete tool is simply fantastic! I did find one scenario where it is failing to delete types of Intune objects which is for Autopilot profiles.
Shown below is an example of duplicate Autopilot profiles:
When I select some of the duplicates and proceed, they are not deleted, and I get these error messages:
Installing Microsoft Graph modules if required (current user scope)
Microsoft Graph Already Installed
Version 2 module detected
Connected to Intune tenant
20dd3f34-d210-423d-93c5-fa0412b41b05
It's an Autopilot Profile
Invoke-MgGraphRequest : DELETE
https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles/20dd3f34-d210-423d-93c5-fa0412b41b05
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: 4b058a4d-a784-41c7-95ed-b83996791a7e
client-request-id: cb37c5a5-2535-49f4-9c79-1668688b25c2
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Central US","Slice":"E","Ring":"2","ScaleUnit":"000","RoleInstance":"CY4PEPF00013268"}}
Date: Mon, 16 Dec 2024 15:27:43 GMT
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"BadRequest","message":"{\r\n "_version": 3,\r\n "Message": "An error has occurred - Operation ID (for customer support):
00000000-0000-0000-0000-000000000000 - Activity ID: cb37c5a5-2535-49f4-9c79-1668688b25c2 - Url: https://fef.amsua0102.manage.microsoft.com/DeviceEn
rollmentFE/StatelessDeviceEnrollmentFEService/deviceManagement/windowsAutopilotDeploymentProfiles('20dd3f34-d210-423d-93c5-fa0412b41b05')?api-versi
on=5023-06-28",\r\n "CustomApiErrorPhrase": "",\r\n "RetryAfter": null,\r\n "ErrorSourceService": "",\r\n "HttpHeaders": "{}"\r
n}","innerError":{"date":"2024-12-16T15:27:43","request-id":"4b058a4d-a784-41c7-95ed-b83996791a7e","client-request-id":"cb37c5a5-2535-49f4-9c79-166
8688b25c2"}}}
At C:\Users\ricke\Documents\files\My Documents\Security and Compliance\Azure AD\scripts\Bulk delete Intune configs.ps1:1339 char:16
}:HttpRequestMessage) [Invoke-MgGraphRequest], HttpResponseException
Deleted
ClientId : 14d82eec-204b-4c2f-b7e8-296a70dab67e
TenantId : c39ecc73-1d29-4b61-a7c4-9f72eac49e60
Scopes : {AdministrativeUnit.Read.All, AdministrativeUnit.ReadWrite.All, Agreement.Read.All, Application.Read.All...}
AuthType : Delegated
TokenCredentialType : InteractiveBrowser
CertificateThumbprint :
CertificateSubjectName :
SendCertificateChain : False
Account : [email protected]
AppName : Microsoft Graph Command Line Tools
ContextScope : CurrentUser
Certificate :
PSHostVersion : 5.1.26100.2161
ManagedIdentityId :
ClientSecret :
Environment : Global
Would you have any idea why these particular profiles cannot be successfully deleted?
Thank you,
Rick
The text was updated successfully, but these errors were encountered: