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:
What am I doing wrong? I am very new to Azure and PowerShell.
CodePudding user response:
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.