internal/tasks/Set-Arm.UserAssignedIdentities.ResourceId.AsVariable.task.ps1
$parm = @{ Description = @" Creates an Arm variable: userAssignedIdentityName -Sets the default value to the original name, extracted from Microsoft.ManagedIdentity/userAssignedIdentities/XYZ Sets the value for all references to: [resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', variables('UserAssignedIdentityName'))] "@ Alias = "Arm.Set-Arm.UserAssignedIdentities.ResourceId.AsVariable" } Task -Name "Set-Arm.UserAssignedIdentities.ResourceId.AsVariable" @parm -Action { Set-TaskWorkDirectory $raw = Get-TaskWorkRaw if ($raw -match '"/subscriptions/.*/resourceGroups/.*/providers/Microsoft.ManagedIdentity/userAssignedIdentities/(.*)"') { $temp = $raw.Replace($Matches[0], "`"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', variables('UserAssignedIdentityName'))]`"") $armObj = $temp | ConvertFrom-Json $armObj = Add-ArmVariable -InputObject $armObj -Name "userAssignedIdentityName" -Value $Matches[1] } else { $armObj = $raw | ConvertFrom-Json } Out-TaskFileArm -InputObject $armObj } |