Set-AzDefault: Default Resource Group cannot be set on CloudShell

Alok Saraswat 25 Reputation points
2024-01-10T09:06:44.05+00:00

Hi Team,

Training Name: Deploy Azure infrastructure by using JSON ARM template

Unit No: 3

Issue:

I am successfully able to connect with Azure through VS Code but getting error as "Set-AzDefault: Default Resource Group cannot be set on CloudShell". For quick reference I am sharing screenshots of

  1. Microsoft learn command page Microsoft Learn Steps.PNG
  2. VS code terminal page with error VS Code Error.PNG
  3. Azure portal with RG and AD details Resource Group.PNG
Azure Azure Training
0 comments No comments
{count} votes

Accepted answer
  1. TP 124.7K Reputation points Volunteer Moderator
    2024-01-10T09:56:06.9833333+00:00

    Hi Alok,

    It is intended that you run the commands using Azure PowerShell in VS Code Terminal on your local PC. Based on your screenshot, you are attempting to run the commands using Azure Cloud Shell in VS Code Terminal, which is not the same thing.

    NOTE: As detailed in the Introduction unit, you need to have Azure PowerShell installed on your local PC among other prerequisites. Please download and install Azure PowerShell if you haven't already.

    In VS Code Terminal, click the Launch Profile... (plus icon) button and switch to PowerShell, as shown:

    qna azure powershell in vscode

    Once you have PowerShell prompt, enter the commands as described in the Unit 3 exercise.

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.