In my release pipeline i am trying to run the powershell script using "File path". In the arguments section i have passed what was defined in the variables section -databasename $(databasename) -dbpassword $(dbpassword) and i also added these parameters in the powershell script. A portion of the script is below -:
#Looping through the database names specified in variables
foreach ($db in $multipledb)
#Declare and define variables
$server = 'nrisql2'
$sqlusername = 'davedutch'
$sqlpassword = '$(dbpassword)'
$buildnumber = '$(build.buildnumber)'
#Split the variable so it finds the hyphen from the string and use the left side of the string
$partialbuildnumbersplit = $buildnumber.split('-')[-2]
#Always skip first 4 characters NRI_
but when i try to run the pipeline it gives me the following error -:
"You cannot call a method on a null-valued expression"
Not sure what i am doing wrong. Can you advise?