Lars Christian Jensen
Lars Christian Jensen

Reputation: 83

Using Powershell cmdlet in Azure DevOps

I've been attempting to use PowerShell PowerApps cmdlets (https://powerapps.microsoft.com/en-us/blog/gdpr-admin-powershell-cmdlets/ ) in DevOps and failing. They work very well on the desktop but when I run them in a PowerShell task in DevOps it just always stalls, no error. It simply runs but never finished or reports an error. I'm sure there's some detail I'm missing I just do not know what. Can anyone help get me on the right track?

Upvotes: 0

Views: 924

Answers (1)

Joy Wang
Joy Wang

Reputation: 42063

I suppose you used an interactive way to login with Add-PowerAppsAccount. In Azure DevOps pipeline, the interactive way is not supported.

In this case, your option is to install the modules with -Force and use a non-interactive way to login, e.g. as mentioned in the blog.

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber -Force

$pass = ConvertTo-SecureString "password" -AsPlainText -Force
Add-PowerAppsAccount -Username [email protected] -Password $pass

Note: Make sure the user account is not MFA-enabled, otherwise you could not use it in the pipeline.

Upvotes: 1

Related Questions