VSTS Azure powershell : No default subscription has been designated
<p>I'm trying to run some azure powershell commands as part of my Visual Studio Team Services build using Azure Resource Manager.</p>

<p>It gives me the following error:</p>

<p>No default subscription has been designated. Use Select-AzureSubscription -Default  to set the default subscription.</p>

<p><a href="https://i.stack.imgur.com/gUGLa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gUGLa.png" alt="VSTS azure powershell error"></a></p>

<p>The commands I'm trying to run:</p>

<pre><code>$website = Get-AzureWebsite | where {$_.Name -eq 'my-website'}
Write-Output ("##vso[task.setvariable variable=DeployUrl;]$website.HostNames")
</code></pre>

<p>When I tried to run it locally, I had to call </p>

<pre><code>Add-AzureAccount
Select-AzureRmSubscription -SubscriptionName "Visual Studio Premium with MSDN"
</code></pre>

<p>to get it working, but it is not possible in the VSTS build. </p>

<p>UPDATE:</p>

<p>I've configured it to use the azure classic mode instead of resource manager, at it works. I don't think that it is a feasible solution for production as azure classic mode is obsolete.</p>