How am I able to run PowerShell commands against a Windows 2016 vm in Azure without using winrm or pssession where I have to install\configure a self signed cert?
Does anyone know
If I understand your query correctly, you want to run PowerShell commands on Azure VM
Other than that, there are several ways to run commands and scripts on Azure VMs depending on the design you need to implement.
You can use Azure portal to execute predefined, custom PowerShell commands on a VM using Virtual Machine blade in Azure portal.
Also please take a look at these docs for more reference :
Can I run powershell commands from Azure DevOps to vm's in Azure?
Run PowerShell scripts in your Windows VM by using Run Command provides two possible directions:
You can use Azure CLI task in azure devops pipeline to run az vm start
and az vm run-command invoke commands. The az vm start will start the VM, the second command will then run the PS commands.
You can use Azure Powershell task in azure devops pipeline to run Start-AzVM and Invoke-AzVMRunCommand commands.
Note:
It requires several seconds even when starting VM in web portal, so it's recommended to have 10~15 seconds as interval between these two commands(Start VM and Run PS). eg:
Try Start-Sleep -s 15.