1
votes

I want to deploy resources to my Azure subscription with Visual Studio. I created a new "Azure Resource Group" project and see WebSite.json, WebSite.parameters.json and Deploy-AzureResourceGroup.ps1. When I right-click on the project and choose "New Deployment" I can login to my subscription in the pop up window. But when I click the "Deploy" button I see in the output window my correct Account, TenantId, SbuscriptionId and Name but then only errors:

15:47:58 - [ERROR] New-AzureRmResourceGroup : Run Login-AzureRmAccount to login.
15:47:58 - [ERROR] At C:\Users\Frederic\Documents\Visual Studio 2015\Projects\AzureResourceGroup1\
15:47:58 - [ERROR] AzureResourceGroup1\bin\Debug\staging\AzureResourceGroup1\Scripts\Deploy-AzureR
15:47:58 - [ERROR] esourceGroup.ps1:96 char:1
15:47:58 - [ERROR] + New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Resource ...

When I open a PowerShell command window and run Login-AzureRmAccount first it works but what am I missing (or how to do it) with VS?

1
Can you check a few things for me? 1) what version of the Azure SDK do you have installed? 2) What version of the Azure PowerShell cmdlets are installed? 3) You mentioned that you can run Login-AzureRMAccount from a PS window, can you execute the script as well? (You can see the entire cmdline VS uses in the output window if you want to copy/paste)..bmoore-msft
WPI says, that Azure SDK 2.9.1 is installed and the Azure module in powershell shows 2.0.1. And yes, I can execute the script with PowerShell ISE and see the resources in my Azure subscriptionFrederic
a little addition: When I run the script in PowerShell I see the exact same error as in my post. I need to run Login-AzureRmAccount first, then the script worksFrederic
Hmm... this sounds like a bug of some sort, can you email me so we can try to debug? bmoore @ microsoft combmoore-msft
Great offer, thx @bmoore-msft Two more details: The ResourceGroup gets created in the targeted Azure subscription but without any resource (should just be a WebApp) And I tried it from a fresh VM on Azure with Visual Studio installed and there it works so must be a local problem.Frederic

1 Answers

0
votes

I was for three weeks in holidays and when I came back there was the Windows Anniversary Update and the new Azure SDK 2.9 that I installed and one of them has solved the problem. Now I can deploy Azure Resource templates from Visual Studio without problems :-)