Running during yaml BUILd pipeline and v5 results in 'You cannot call a method on a null-valued expression'
During our swap over from classic pipelines we want to do post-deployment tasks for updating apim. This has previously been done in classic releasepipeline so configuration should work and we have used the 'export yaml' part.
Also tested doing adjuments to configuration but i cannot get it to work.
As others have said here I've tested downgrading TLS to 1.0 from 1.2 but this didn't solve anything.
Services: Azure deveops Agent: Microsoft hosted Pipeline: Yaml Pipeline type: build pipe Task version: 5.0.1 Task: API Management - Create/Update API
checking whether https://management.azure.com/subscriptions/xx/resourceGroups/xx/providers/Microsoft.ApiManagement/service/xx/apis/xx?api-version=2019-01-01 exists
##[debug]GET https://management.azure.com/subscriptions/xx/resourceGroups/xx/providers/Microsoft.ApiManagement/service/xx/apis/xx?api-version=2019-01-01 with 0-byte payload
##[debug]received 1489-byte response of content type application/json; charset=utf-8
found api
##[debug]Leaving D:\a\_tasks\apimversioned_caee5262-b7ce-48c9-b5f7-70c586148ff8\5.0.1\apimversioned.ps1.
##[debug]Caught exception from task script.
##[debug]Error record:
##[debug]D:\a\_tasks\apimversioned_caee5262-b7ce-48c9-b5f7-70c586148ff8\5.0.1\apimversioned.ps1 : You cannot call a method on a null-valued expression.
##[debug]At line:1 char:1
##[debug]+ . 'D:\a\_tasks\apimversioned_caee5262-b7ce-48c9-b5f7-70c586148ff8\5.0 ...
##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug] + CategoryInfo : InvalidOperation: (:) [apimversioned.ps1], RuntimeException
##[debug] + FullyQualifiedErrorId : InvokeMethodOnNull,apimversioned.ps1
##[debug]
##[debug]Script stack trace:
##[debug]at <ScriptBlock>, D:\a\_tasks\apimversioned_caee5262-b7ce-48c9-b5f7-70c586148ff8\5.0.1\apimversioned.ps1: line 367
##[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.RuntimeException: You cannot call a method on a null-valued expression.
##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
##[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
##[debug] at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
##[debug] at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
##[debug] at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
##[debug] at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
##[debug] at System.Management.Automation.CommandProcessorBase.Complete()
##[error]You cannot call a method on a null-valued expression.
##[debug]Processed: ##vso[task.logissue type=error]You cannot call a method on a null-valued expression.
##[debug]Processed: ##vso[task.complete result=Failed]
Hi surfaace, i am having similar scenario to yours. Have you been able to resolve this?
I have not and i see that i dont have added the configuration(s) tested. Once i start tackle this again i will post configuration updates