neilpeterson / azure-blueprints-pipeline-tasks

MIT License
17 stars 16 forks source link

Blueprint Assignment Fails #70

Open kbruland opened 3 years ago

kbruland commented 3 years ago

Is there a case sensitivity bug in line 89 of assignBlueprint.ps1? My pipeline is throwing an error: ##[error]Cannot bind argument to parameter 'InputObject' because it is null.

After tracing through the logs, it looks like $BluePrintObject.id in line 89 of assignBlueprint.ps1 maybe should be $BluePrintObject.Id instead (capital I on .Id)?

body.properties | Add-Member -Name "blueprintId" -value $BluePrintObject.id -MemberType NoteProperty -Force

Change to this?

body.properties | Add-Member -Name "blueprintId" -value $BluePrintObject.Id -MemberType NoteProperty -Force

When I run the PowerShell command which loads the blueprint with the exact same parameters as in the pipeline: Get-AzBlueprint -Name blueprints-demo -SubscriptionId (redacted)

This is the return value, and the Id field is capitalized, which may be causing the error as the PowerShell script is looking for lowercase on line 89.

Name : blueprints-demo Id : /subscriptions/(redacted)/providers/Microsoft.Blueprint/blueprints/blueprint s-demo SubscriptionId : (redacted) Versions : {1, 2, 3, 4...} Description : Cloud Adoption Framework for Azure – Configure Foundational best practices TimeCreated : 7/9/2021 8:19:10 PM TargetScope : Subscription Parameters : {appendataganditsvaluetoresourcegroups_tagValue, enableMonitoringinAzureSecurityCenter_adaptiveApplicationControlsMonitoringEffect, enableMonitoringinAzureSecurityCenter_diagnosticsLogsInBatchAccountMonitoringEffect, enableMonitoringinAzureSecurityCenter_diagnosticsLogsInBatchAccountRetentionDays...} ResourceGroups : {SharedServices-RG, Network-RG, ResourceGroup}

I'm running version 0.4.0 of Az-Blueprint.