-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveAzureADAppRegistrations.ps1
More file actions
35 lines (30 loc) · 994 Bytes
/
RemoveAzureADAppRegistrations.ps1
File metadata and controls
35 lines (30 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Install-Module -Name AzureADPreview
$tenantId = "[Tenant id]"
$creds = Get-Credential
Connect-AzureAD -TenantId $tenantId -Credential $creds
$vstsAppId = "499b84ac-1321-427f-aa17-267ca6975798"
$vstsObjectId = $null # Clear the object if the script is run multiple times
$vstsObjectId = (Get-AzureADServicePrincipal | ? AppId -eq $vstsAppId | SELECT objectId).objectId
if ($vstsObjectId -ne $null)
{
Remove-AzureADServicePrincipal -ObjectId $vstsObjectId
Write-Host "VSTS App Registration deleted" -ForegroundColor Yellow
}
else
{
Write-Host "VSTS App Registration not found"
}
# Generic App
Get-AzureADServicePrincipal
Get-AzureADApplication
$genericObjectId = "[Insert Object Id]"
if ($genericObjectId -ne $null)
{
#Remove-AzureADServicePrincipal -ObjectId $genericObjectId
#Remove-AzureADApplication -ObjectId $genericObjectId
Write-Host "Generic App Registration deleted" -ForegroundColor Yellow
}
else
{
Write-Host "Generic App Registration not found"
}