Aammir Mirza
Sep 1, 2023

--

Did you also tried importing the module ?

I tried running it Azure DevOPs Windows Agent and I am getting the output as expected.

Generating script.

========================== Starting Command Output ===========================

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\6db831dc-cd5b-4956-bca7-33a3e9f9f051.ps1'"

CommandType Name Version Source

----------- ---- ------- ------

Function ConvertTo-SPOT 1.0.6 ConvertTo-Spot

Set-AzContext : The term 'Set-AzContext' is not recognized as the name of a cmdlet, function, script file, or operable

program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At C:\Program Files\WindowsPowerShell\Modules\ConvertTo-Spot\1.0.6\ConvertTo-SPOT.ps1:24 char:16

+ $context = Set-AzContext $subscriptionName

+ ~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (Set-AzContext:String) [], ParentContainsErrorRecordException

+ FullyQualifiedErrorId : CommandNotFoundException

##[error]PowerShell exited with code '1'.

Finishing: PowerShell Script

--

--

Aammir Mirza

Cloud Architect with 12 years of experience in managing cloud infrastructure and automation, integrating Azure cloud-based infra components