I am trying to execute Get-AzSqlServer from AzureCli@2 yaml pipeline and it is throwing an error:
The term ‘Get-AzSqlServer ‘ is not recognized as the name of a cmdlet
Here is my task
- task: AzureCli@2
inputs:
azureSubscription: 'serviceconnection'
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
$sqlServer = Get-AzSqlServer -ResourceGroupName rgTest
2
Answers
Try to use:
Use
AzurePowerShell@5
if you want to run PowerShell in an authenticated session.You could also try running
Import-Module
for the appropriate Azure PowerShell modules, but I don’t guarantee that would work.