Last active
June 7, 2024 09:34
-
-
Save bmoore-msft/ae6b8226311014d6e7177c5127c7eba1 to your computer and use it in GitHub Desktop.
Revisions
-
bmoore-msft revised this gist
Feb 16, 2021 . 1 changed file with 10 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,18 @@ Param( [string][Parameter(Mandatory=$true)]$deploymentName, # the full name of the deployment, e.g. pid-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX [string][Parameter(Mandatory=$true)]$resourceGroupName ) # Get the correlationId of the named deployment $correlationId = (Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name "$deploymentName").correlationId # Find all deployments with that correlationId $deployments = Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName | Where-Object{$_.correlationId -eq $correlationId} # Find all deploymentOperations in all deployments with that correlationId as PowerShell doesn't surface outputResources on the deployment or correlationId on the deploymentOperation foreach ($deployment in $deployments){ # Get deploymentOperations by deploymentName # then the resourceIds for each resource ($deployment | Get-AzResourceGroupDeploymentOperation | Where-Object{$_.targetResource -notlike "*Microsoft.Resources/deployments*"}).TargetResource } -
bmoore-msft revised this gist
Oct 3, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Param( [GUID][Parameter(Mandatory=$true)]$guid, [string][Parameter(Mandatory=$true)]$resourceGroupName ) #get the correlationId of the pid deployment -
bmoore-msft created this gist
Jun 13, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <# Use this script to retrieve the resources that were deployed with a pid-[GUID] tag Select-AzureRMContext before running the script - it must be run within the subscription context of the deployment The GUID and resourceGroup name of the deployment are required params #> Param( [GUID][Parameter(Mandatory=$true)]$guid, [string][Parameter(Mandatory=$true)]$resourceGroupName' ) #get the correlationId of the pid deployment $correlationId = (Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name "pid-$guid").correlationId #find all deployments with that correlationId $deployments = Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName | Where-Object{$_.correlationId -eq $correlationId} #find all deploymentOperations in a deployment by name (since PowerShell does not surface outputResources on the deployment or correlationId on the deploymentOperation) foreach ($deployment in $deployments){ #get deploymentOperations by deploymentName and then the resourceId for any create operation ($deployment | Get-AzureRmResourceGroupDeploymentOperation | Where-Object{$_.properties.provisioningOperation -eq "Create" -and $_.properties.targetResource.resourceType -ne "Microsoft.Resources/deployments"}).properties.targetResource.id }