In this Azure tutorial, we will discuss how to fix the error a positional parameter cannot be found, which I got while trying to create an Azure Resource Group in the Azure Portal using PowerShell ISE.
Table of Contents
A positional parameter cannot be found that accepts argument
Well, Recently, while trying to create a Resource Group using the PowerShell script, I got this error, and the PowerShell script that I was running was as below
Connect-AzureRmAccount
$ResourceGroupName = "Demo123"
$location = "EastUS"
New-AzureRmResourceGroup - Name $ResourceGroupName - Location $location After executing the above script, I got this error. You can see the same below

The complete error message was as below
New-AzResourceGroup: A positional parameter cannot be found that accepts argument
‘Demo123’.
At line:4 char:1
- New-AzureRmResourceGroup – Name $ResourceGroupName – Location $locati …
~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidArgument: (:) [New-AzResourceGroup], ParameterBi
ndingException - FullyQualifiedErrorId: PositionalParameterNotFound,Microsoft.Azure.Commands.Re
sourceManager.Cmdlets.Implementation.NewAzureResourceGroupCmdlet
- CategoryInfo : InvalidArgument: (:) [New-AzResourceGroup], ParameterBi
Reason For The Issue
The reason for this issue is a silly mistake. If you look closely, By mistake, there is one space I put in between the Name and “-” character, and in the same way, there is one more space between the Location and the “-” character.
This was the reason for the error. I have highlighted the mistake below. I know this is a silly mistake and can happen sometimes in a hurry.

A positional parameter cannot be found that accepts argument [Solved]
Now, To fix the issue and to create the Azure Resource Group successfully, Follow the below steps
1. Open the Windows PowerShell or PowerShell ISE as Run as Administrator mode.

2. Now Run the script below to Create the Resource Group in Azure Successfully
Note: Make sure not to put any space between the hyphen(-) and the Name parameter, and in the same way, Don’t put any space between the hyphen(-) and the Location parameter.
Connect-AzureRmAccount
$ResourceGroupName = "Demo123"
$location = "EastUS"
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $location Once you will execute the script, it will prompt you to enter your Azure Credential. Enter the Azure Credential and then click on the Sign-in button.
Now you can see our Azure Resource Group in Azure is created successfully without any issues.

Below are a few additional scenarios you need to be careful about to get rid of this error
- Sometimes, if you have any parameters with spaces, then make sure to put the parameter with double quotes. For example, if it is a Hello Test, you should keep it like “Hello Test.”
- Make sure to use the operator as “-“(Hyphen), not the “_”(Underscore).
- If any of your parameters contain the underscore, then put the complete parameter with “double-quotes”. For example, say your parameter is Hello_Test_Test, then specify “Hello_Test_Test”.
You may also like following the articles below
- The ‘Get-AzResourceGroup’ command was found in the module ‘Az. Resources
- No match was found for the specified search criteria and module names ‘AzTable’
- The ‘New-AzResourceGroup’ command was found in the module ‘Az. Resources
- CS1061 C# ‘HttpRequest’ does not contain a definition for ‘Content’ and no accessible extension method ‘Content’ accepting a first argument of type ‘HttpRequest’ could be found
Wrapping Up
Well, in this article, we discussed how to fix the PowerShell error New-AzResourceGroup: A positional parameter cannot be found that accepts argument. I hope it will help you to fix your issue as well !!!

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
