neilpeterson / azure-blueprints-pipeline-tasks

MIT License
17 stars 16 forks source link

"Cannot bind argument to parameter 'String' because it is null." error when using User Assigned Managed Identity #52

Open stefanpetter opened 4 years ago

stefanpetter commented 4 years ago

I want to create, publish and assign blueprints using an User Assigned Managed Identity. I think the current script does not account for that. I added a screenshot of the failed task.


> ##[section]Starting: CreateBlueprint
> 
> ==============================================================================
> Task         : Create Azure Blueprint
> Description  : Creates an Azure Blueprint
> Version      : 1.5.6
> Author       : Neil Peterson
> Help         : 
> ==============================================================================
> ##[debug]Caught exception from task script.
> ##[debug]Error record:
> ##[debug]ConvertTo-SecureString : Cannot bind argument to parameter 'String' because it is null.
> ##[debug]At D:\a\_tasks\CreateBlueprint_1a8623d7-1d5c-423c-9d92-5e9587bbb02a\1.5.6\createBlueprint.ps1:14 char:65
> ##[debug]+ ... ters.ServicePrincipalKey | ConvertTo-SecureString -AsPlainText -Force
> ##[debug]+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ##[debug]    + CategoryInfo          : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException
> ##[debug]    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSe    cureStringCommand
> ##[debug] 
> ##[debug]Script stack trace:
> ##[debug]at <ScriptBlock>, D:\a\_tasks\CreateBlueprint_1a8623d7-1d5c-423c-9d92-5e9587bbb02a\1.5.6\createBlueprint.ps1: line 14
> ##[debug]at <ScriptBlock>, <No file>: line 1
> ##[debug]at <ScriptBlock>, <No file>: line 22
> ##[debug]at <ScriptBlock>, <No file>: line 18
> ##[debug]at <ScriptBlock>, <No file>: line 1
> ##[debug]Exception:
> ##[debug]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'String' because it is null.
> ##[debug]   at System.Management.Automation.CmdletParameterBinderController.BindValueFromPipeline(PSObject inputToOperateOn, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
> ##[debug]   at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingStateInParameterSet(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
> ##[debug]   at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingState(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
> ##[debug]   at System.Management.Automation.CmdletParameterBinderController.BindPipelineParametersPrivate(PSObject inputToOperateOn)
> ##[debug]   at System.Management.Automation.CmdletParameterBinderController.BindPipelineParameters(PSObject inputToOperateOn)
> ##[debug]   at System.Management.Automation.CommandProcessor.Read()
> ##[error]Cannot bind argument to parameter 'String' because it is null.
> ##[debug]Processed: ##vso[task.logissue type=error]Cannot bind argument to parameter 'String' because it is null.
> ##[debug]Processed: ##vso[task.complete result=Failed]
> ##[section]Finishing: `CreateBlueprint
neilpeterson commented 4 years ago

@stefanpetter thanks for the issue. This makes sense, I will look into it as soon as possible.