I have a build agent set up on a VM in Azure, that is linked to our Visual Studio Online.
I then have an Azure Powershell build step that runs a script that tries to execute New-AzureResourceGroup.
This results in the following:
New-AzureResourceGroup : Unauthorized
113 ##[error]At C:\BuildAgents\agent\_work\[...]\Deploy-AzureResourceGroup.ps1:47 char:1
114 ##[error]+ New-AzureResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation ...
115 ##[error]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 ##[error]+ CategoryInfo : CloseError: (:) [New-AzureResourceGroup], CloudException
117 ##[error]+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupCommand
I can run these scripts locally with no problem.
I have tried importing a publish settings file in the script, but it seems New-AzureResourceGroup is not allowed authentication this way.
I run the build agent as a service under a local user account (not network service).
Does anyone know how to allow the build agent execute New-AzureResourceGroup?
I hope to be able to do a full continuous deployment including setting up and managing everything needed in Azure, including the resource groups.
UPDATE
According to the article below:
"If you connect using this method [publish settings file], you can only use the Azure Service Management (or the ASM mode) commands."
https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-connect/
I'm assuming this applies to Azure powershell as well.
So, is there really no way of managing resources in azure without using account based authentication?
UPDATE
Thanks to @bmoore-msft for providing the missing piece. I'll just add another screen shot of the link I needed to find to set up the build to run under an actual account.