Seems you have hardcoded values in the script and a missing variable
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- powershell
- Domain
- cloud
Research direction
Find the script containing $subId, $SubscriptionId, $rgNameWorkspace, and $workspaceName, then compare its parameter definitions with the reported commands. Confirm that the subscription and workspace values come from the supplied parameters rather than hardcoded values, and run the script to verify Set-AzContext no longer receives a null subscription.
Written by the indexing model from the issue text.
Description
Hi there
where running your script, always got the below error
Set-AzContext : Cannot validate argument on parameter 'Subscription'. The argument is null or empty. Provide an argument that is not null or empty
Looking at the script code you are using a variable $subId which does not exist; the parameter one is $SubscriptionId
Then, you have also hardcoded value for the workspace RG and and name
$rgNameWorkspace = 'rg-jamui-workspace'
$workspaceName = 'workspace-jamui-1'
When fixing these issues, the script can run successfully as per below
Connect-AzAccount
Select-AzSubscription -Subscription $SubscriptionId
$rgNameWorkspace = $ResourceGroupName
$workspaceName = $WorkspaceName
- Dominant language
- PowerShell
- Stars
- 1.2k
- Forks
- 493
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/AzureMonitorCommunity
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 10/100
All issues in microsoft/AzureMonitorCommunity
Similar issues
-
Language: Terraform :globe_with_meridians: Needs: Triage :mag: Type: Bug :bug:
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Azure/terraform-azurerm-avm-res-containerregistry-registry#230 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100