I am currently writing a script in powershell that performs a test move of resources in Azure. I am currently receiving an error
Invoke-AzResourceAction : ResourceMoveNotSupported : Resource move is not supported for resource types 'microsoft.insights/activityLogAlerts'. CorrelationId: SomeLongStringOfRandomStuff At C:\Users\pcname\Documents\NewScript.ps1:16 char:9
-
Invoke-AzResourceAction -Action validateMoveResources -Resour ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : CloseError: (:) [Invoke-AzResourceAction], ErrorResponseMessageException
- FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet
I would like to be able to retrieve the correlation ID, and put that into an Excel sheet, how can I filter for this? I can't use a static substring as the names can be extremely difficult, however this error is on its own line, how can I go about this?
try
{
Invoke-AzResourceAction -Action validateMoveResources -ResourceId $ResourceGroupID -Parameters @{ resources=@($ResourceID);targetResourceGroup = $resource.TargetResourceGroup }
Write-Host $ResourceID + " Has been moved succesfully"
}
catch
{
Write-Host $_.CorrelationID #This should be the object that is returned
}