we noticed that resource group is limited to 800 deployments in its deployment history.
At the end we have question about Monitoring Part.
PowerShell Script to get list of Resource Group Name along with Deployment Name and Status of all Deployments for all resource group within a Subscription and export as CSV file.
# Login to your Azure account
# Set the subscription context
# Get all resource groups in the subscription
# Initialize an array to store successful and failed deployments
# Get successful and failed deployments for each resource group
# Add successful and failed deployments to the array
# Export successful and failed deployments to a CSV file
$resourceGroups = Get-AzResourceGroup
$deploymentsInfo = @()
foreach ($resourceGroup in $resourceGroups) {
$failedDeployments = Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroup.ResourceGroupName | Where-Object { $_.ProvisioningState -eq "Failed" }
$successfulDeployments = Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroup.ResourceGroupName | Where-Object { $_.ProvisioningState -eq "Succeeded" }
foreach ($deployment in $failedDeployments) {
$deploymentInfo = [PSCustomObject]@{
ResourceGroupName = $resourceGroup.ResourceGroupName
DeploymentName = $deployment.DeploymentName
ProvisioningState = $deployment.ProvisioningState
Status = "Failed"
}
$deploymentsInfo += $deploymentInfo
}
foreach ($deployment in $successfulDeployments) {
$deploymentInfo = [PSCustomObject]@{
ResourceGroupName = $resourceGroup.ResourceGroupName
DeploymentName = $deployment.DeploymentName
ProvisioningState = $deployment.ProvisioningState
Status = "Successful"
}
$deploymentsInfo += $deploymentInfo
}
}
$deploymentsInfo | Export-Csv -Path "AllDeployments.csv" -NoTypeInformation
PowerShell Script to get Only list of Resource group name and count of Failed and Successful Deployments for all resource group within a Subscription and export as CSV file.
# Login to your Azure account Connect-AzAccount # Set the subscription context Set-AzContext -SubscriptionId "