In the Azure portal I created an Automation Account with a Powershell 7.2 runbook.
From within the runbook, when I click Edit and choose Edit in VS Code I am then presented with an invitation to install Azure Automation.
When I do that, VS Code complains that Azure Account is Depricated.
When I return to the runbook and choose Edit in VS Code I am still prompted to Install Azure Automation.
I tried removing the Azure Account extension in VS Code but this also caused the Azure Automation Extension to be removed.
The issue is because of the Azure Account Extension deprecation. It has been deprecated since January and the same is described under Vs code Extensions >> Azure Account
.
As a workaround, you can connect to automation runbook by authenticating into Azure using az login
or connect-AzAccount
commands from vs code terminal.
Alternatively, you can use the command palette to sign into Azure even though the extension is deprecated.
As detailed in the MSDoc, you can follow the steps given to choose the runbook from the specific subscription and click on Run local
to execute it in local machine.
I have tried the same in my vs code environment and was able to execute it successfully as shown below.
write-Host "Hello world!"
In the same way, you can also use Az PowerShellSet-AzAutomationRunbook
or Az CLI az automation runbook update
command to connect to automation runbooks from vs code (local) to Azure and work accordingly.