« Home

Delete multiple Azure Active Directory applications via PowerShell

25 September 2018, Birmingham, UK

Recently, I needed a quick way to delete multiple Azure Active Directory applications. This is unfortunately not possible through the Azure portal, so it was time for a little PowerShell magic.

I came up with a little command named Remove-AzureADApplications, which will present a list of applications on your tenant and delete the selected applications. It also features a silent execution mode (-Force parameter) and a display name begins with filter option (-SearchString parameter).

Check it out:

Remove local git branches that are deleted from the origin.

Removes local git branches that are deleted from the origin using `git fetch --prune` and `git branch -[dD]`.

Switch to to force removal using `git branch -D` instead of `git branch -d`.

Removes merged non-existing branches.

Remove-DeletedGitBranches -Force
Removes all non-existing branches.

This cmdlet uses `git fetch --prune`, so it will delete references to non-existing branches in the process. Use with caution.
function Remove-DeletedGitBranches

    $null = (git fetch --all --prune);
    $branches = git branch -vv | Select-String -Pattern ": gone]" | ForEach-Object { $_.toString().Split(" ")[2] };
        $branches | ForEach-Object {git branch -D $_};
        $branches | ForEach-Object {git branch -d $_};        

Set-Alias -Name "rmdelbr" -Value Remove-DeletedGitBranches