Hi @KE1980 ,
I just did some testing in my environment. Both scripts are working here now.
In the first script I have to remove the quotes around the $_.DatabaseName
Get-AzSqlDatabase -ResourceGroupName "ResourceGroup-Backup" -ServerName "backupserver" -DatabaseName "Backup*" |
ForEach {
$_.DatabaseName # | Select *
Remove-AzSqlDatabase -ResourceGroupName "ResourceGroup-Backup" -ServerName "backupserver" -DatabaseName $_.DatabaseName -Force
}
And the second script is working from the beginning:
Get-AzSqlDatabase -ResourceGroupName "ResourceGroup-Backup" -ServerName "backupserver" -DatabaseName "Backup*" |
Remove-AzSqlDatabase -Force
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten