microsoft / microsoft/AzureMonitorCommunity
Seems you have hardcoded values in the script and a missing variable
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 1.2k
- Forks
- 493
- PR merge metrics
- No merged PRs in 30d
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
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.
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.
Assessment
- Tech stack
- powershell
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100