This post is short but useful. We need just two lines (we can combine it to one):
1
2
$allSites = Get-AzureRmWebApp -ResourceGroupName resource-group-name
@($allSites).GetEnumerator() | Restart-AzureRmWebApp
The trick is to use GetEnumerator()
because above commandlet returns System.Collections.Generic.List
instead of array of individual objects into pipeline.
This also works with Stop-AzureRmWebApp
and Start-AzureRmWebApp
.
Simple, fast and useful. What we need more :)