user_50520
user_50520

Reputation: 37

Can't create resource group via Powershell

I am trying to create one resource group via PowerShell.

I am using below command to achieve that:

 New-AzResourceGroup -Name "RG01" -Location "Central US"

I am following this Microsoft document: https://learn.microsoft.com/en-us/powershell/module/az.resources/new-azresourcegroup?view=azps-7.5.0

I have Az module installed in my PowerShell. Still I'm getting below error:

enter image description here

What am I doing wrong? I am very new to Azure and PowerShell.

Upvotes: 0

Views: 520

Answers (1)

Nayan
Nayan

Reputation: 651

Change the execution policy of RemoteSigned for current user scope (Administrator Privileges).

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Import Az Resources Module

Import-Module Az.Resources

Execute Az Module Command for Resource Group creation.

New-AzResourceGroup -Name "RG01" -Location "Central US"

Execution Policy Type

Restricted (Default) - No Script either local, remote or downloaded can be executed on the system.
AllSigned - All script that are ran require to be digitally signed.
RemoteSigned - All remote scripts (UNC) or downloaded need to be signed.
Unrestricted - No signature for any type of script is required.

Scope of new Change

LocalMachine (Default) - The execution policy affects all users of the computer.
CurrentUser - The execution policy affects only the current user.
Process - The execution policy affects only the current Windows PowerShell process.

Upvotes: 1

Related Questions