Filiwiks
Filiwiks

Reputation: 105

Deploy Azure VM from visual studio using json template?

I'm trying to deploy a VM from Visual Studio using a json template. Before i was using the New-AzureResourceManagerDeployment where I could specify "-TemplateFile "$PSScriptRoot\TemplateName.json". That cmdlet is no longer avalible and I can't seem to find an answer anywhere.. What do you suggest I use instead?

Upvotes: 1

Views: 496

Answers (1)

Rick Rainey
Rick Rainey

Reputation: 11256

It sounds like you may have an older deployment script and have since updated your Azure PowerShell cmdlets that use the new "AzureRM" commands. Assuming that's the case, you will need to update your script to use the new "AzureRM" commands. For example, instead of New-AzureResourceManagerDeployment use New-AzureRmResourceManagerDeployment.

Here is an example of how these commands are used in today's version of the deployment script that Visual Studio generates

... <abbreviated to show just the last two Azure PowerShell commands ...    

    #Create or update the resource group using the specified template file and tem plate parameters file
    New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop 

    New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $TemplateFile).BaseName + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) `
                                       -ResourceGroupName $ResourceGroupName `
                                       -TemplateFile $TemplateFile `
                                       -TemplateParameterFile $TemplateParametersFile `
                                       @OptionalParameters `
                                       -Force -Verbose

Upvotes: 1

Related Questions