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?
1 Answer
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.
1 Comment
codewario
Worth a mention, this is a good approach when working with the public
PowerShell Gallery but if using an internally-hosted gallery feed I would recommend marking the repository as trusted, provided public packages are not available through it.
Write-Host "##vso[task.logissue type=command]Testing powershell"