{"id":7529,"date":"2024-03-03T13:26:00","date_gmt":"2024-03-03T13:26:00","guid":{"rendered":"https:\/\/rakhesh.com\/?p=7529"},"modified":"2024-03-03T13:26:00","modified_gmt":"2024-03-03T13:26:00","slug":"delete-all-entra-id-app-registrations-and-enterprise-applications","status":"publish","type":"post","link":"https:\/\/rakhesh.com\/azure\/delete-all-entra-id-app-registrations-and-enterprise-applications\/","title":{"rendered":"Delete ALL Entra ID App Registrations and Enterprise Applications"},"content":{"rendered":"

Deleting a test tenant today and one of the pre-requisites before I can delete is to remove all App Registrations and Enterprise Applications.<\/p>\n

\"\"<\/p>\n

Unfortunately there’s no select all and delete button in the GUI. So here’s what you do:<\/p>\n

Connect-MgGraph -Scopes \"Application.ReadWrite.All\"<\/pre>\n

In the browser window that pops-up, sign in with a Global Admin or Application Admin account (Global Admin usually, coz you also have to delete all users from the tenant so you are likely left with just the Global Admin).<\/p>\n

Then do:<\/p>\n

Get-MgApplication | %{ Remove-MgApplication -Confirm:$false -ApplicationId $_.Id }\r\nGet-MgServicePrincipal | %{ Remove-MgServicePrincipal -ServicePrincipalId $_.Id -Confirm:$false }<\/pre>\n

You might get some errors with the latter, as some Enterprise Applications are from Microsoft. Like this:<\/p>\n

Remove-MgServicePrincipal_Delete: Specified App Principal ID is Microsoft Internal.\r\n\r\nStatus: 400 (BadRequest)\r\nErrorCode: Request_BadRequest\r\nDate: 2024-03-03T13:23:48\r\n\r\nHeaders:\r\nCache-Control                 : no-cache\r\nTransfer-Encoding             : chunked\r\nVary                          : Accept-Encoding\r\nStrict-Transport-Security     : max-age=31536000\r\nrequest-id                    : a6e68670-b3ad-4b9d-bf04-54f121e9b672\r\nclient-request-id             : 1b8d50f7-89cf-41e6-8e18-fd6335ffba8f\r\nx-ms-ags-diagnostic           : {\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"004\",\"RoleInstance\":\"AM2PEPF0000BE54\"}}\r\nx-ms-resource-unit            : 1\r\nDate                          : Sun, 03 Mar 2024 13:23:48 GM<\/pre>\n

In my case what I was left with were the Graph, SharePoint, and PnP Enterprise Applications. I could delete them from the portal.<\/p>\n","protected":false},"excerpt":{"rendered":"

Deleting a test tenant today and one of the pre-requisites before I can delete is to remove all App Registrations and Enterprise Applications. Unfortunately there’s no select all and delete button in the GUI. So here’s what you do: Connect-MgGraph -Scopes “Application.ReadWrite.All” In the browser window that pops-up, sign in with a Global Admin or … Continue reading Delete ALL Entra ID App Registrations and Enterprise Applications<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[887],"tags":[],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7529"}],"collection":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/comments?post=7529"}],"version-history":[{"count":1,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7529\/revisions"}],"predecessor-version":[{"id":7531,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7529\/revisions\/7531"}],"wp:attachment":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/media?parent=7529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/categories?post=7529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/tags?post=7529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}