Get-AzureRmResource returned object does not contain the ResourceName alias as a property
Description
The object(s) being returned from Get-AzureRmResource does not contain the ResourceName alias as a property. This causes scripts that were working with version 5.5.2 of the Azure.Resources module to break on an environment with version 6.4.2 of the Azure.Resources module.
Script/Steps for Reproduction
Make sure you have version 5.5.2 of Azure.Resources module installed Run the Get-AzureRmResource command against your own resourcegroup in Azure
Get-AzResource -ResourceType "microsoft.insights/components" -ResourceGroupName "test"
Observe that the object contains both Name (alias) and ResourceName properties.
Update the Azure.Resources module to 6.4.2 and run the above command again Observe that the object contains only Name property and the ResourceName alias is missing.
I found this commit where the ResourceName property was changes to Name, and the alias changed from Name to ResourceName. My understanding is that the alias should have prevented the breaking change:
https://github.com/Azure/azure-powershell/commit/42620ad5946d223d247354c76a2b97ffd324b868#diff-76be74f33a518ec4cca7c2f2dbf61257L98
Observe
Module Version
5.5.2 AzureRM.Resources
Environment Data
Name Value
PSVersion 5.1.17134.407
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.407
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
@hermot As Cormac pointed out, this was changed as part of a breaking change release. So, migration from a major version (5.x.x to 6.x.x) may contain breaking changes. This was one of those.