Connect to Azure:

How to connect to Azure via Powershell (first time)
Requirements: * PowerShell 5.1 * .NET Framework 4.7.2 or later. * Azure Powershell Module Check Powershell Version: # PSVersioncheck $PSVersionTable.PSVersion Check .NET Framework Version: # Check for .NET Framework 4.7.2 Get-ChildItem ’HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full…

Query and choose a subscription:

# Query and choose a Subscription
$Subscription = Get-AzSubscription | Out-GridView -PassThru
# $Subscription
Select-AzSubscription $Subscription

Dealing with tags inside Azure:

# List tags and their number of occurences
Get-AzTag

# Get all Ressources with a specific Tagdefinition
Get-AzResource -TagName <Tagdefintion>

# Get Tags of a specific Ressource
(Get-AzResource -Name <Ressourcename>).Tags

# Get all Ressource Names with a specific Tag Value
(Get-AzResource -Tag @{<Tagdefintion>="<Tagvalue>"}).Name

# Get a reference to an Azure resource
$r = Get-AzResource -ResourceName <Ressourcename> -ResourceGroupName <Ressourcegroupname>

# Retrieve existing resource tags, if any
$tags = (Get-AzResource -Name <Ressourcename>).Tags

# Add new tags to exiting tags
$tags += @{<Tagdefintion1>="<Tagvalue1>"; <Tagdefintion2>="<Tagvalue2>"}

# Write new tags to an Azure resource
Set-AzResource -ResourceId $r.Id -Tag $tags -Force
#(Get-AzResource -Name <Ressourcename>).Tags

# Restore last status
Set-AzResource -Tag @{<Tagdefintion>="<Tagvalue>"} -ResourceId $r.id -Force
#(Get-AzResource -Name <Ressourcename>).Tags