Skip to content

Bad error with New-AzureResourceGroup when TemplateFile is not found #71

@wadewegner

Description

@wadewegner

I was running the following command ...

New-AzureResourceGroup -Name $name -Location $location -TemplateFile $templateFile -siteName $siteName -hostingPlanName $hostingPlanName -siteLocation $location -Force

... and received an error that took awhile to understand:

New-AzureResourceGroup : A parameter cannot be found that matches parameter name 'siteName'.
At C:\Projects\Github\WadeWegner\azure-go-lang-site-extension\scripts\Deploy.ps1:17 char:84
+ ...  $templateFile -siteName $siteName -hostingPlanName $hostingPlanName -siteLocati ...

When I removed the unknown parameters only then did it give this error:

New-AzureResourceGroup : Could not find file 'C:\Windows\system32\Template.json'.
At C:\Projects\Github\WadeWegner\azure-go-lang-site-extension\scripts\Deploy.ps1:17 char:1
+ New-AzureResourceGroup -Name $name -Location $location -TemplateFile $templateFi ...

Turns out, using the Windows PowerShell ISE, I was in the wrong directory and it couldn't fine the $templateFile.

It would be nice if the cmdlets raised on error on the missing TemplateFile rather than erroring on an unknown parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ARMService AttentionThis issue is responsible by Azure service team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions