New-AzAutomationConnection Cmdlet incorrectly states that -ResourceGroupName parameter value exeeds length of 90.
There appears to be a bug when using this Cmdlet, where the -ResourceGroupName parameter incorrectly states that the parameter value for the resource group exceeds a length of 90 when a variable is used, i.e. $rgName (string length is actually 19 <CZEU2-APP-NP-RGP-01>. When the hard coded value of: "CZEU2-APP-NP-RGP-01" is used however, the Cmdlet works as designed.
WORKAROUND: :-) I found a suitable workaround, which was to dynamically retrieve the value of the desired resource group name as a default parameter value for $resourceGroup in the New-AutomationConnectionAsset user defined function. I also deliberately reduced the string length to 19 characters by invoking the substring method. Please see the attached updated function and the result image. Dear PowerShell Team - please don't close this bug yet as it seems that there is still a problem with the native Cmdlet New-AzAutomationConnection and I would be interested to know when this is resolved (if possible). Thanks to everyone who upvoted my issue. :-)