Azure / Azure/azure-sdk-tools

New-TestResources.ps1 does not support subscription config mode without CI flags

Open
#2,651 0 comments 1 reaction 0 assignees View on GitHub
Central-EngSys
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 2h
Merged PRs (30d)
130

Description

When running locally and using a subscription configuration (for example, to test service principal configurations), the logic is slightly broken. If passing a json subscription config via parameter splatting (i.e. using the `provisioner` parameter set), you must also pass the `-CI` switch flag otherwise the script will break:

```
15:14:04 - Selecting subscription ''
Set-AzContext: /home/ben/sdk/azure-sdk-for-net/eng/common/TestResources/New-TestResources.ps1:410
Line |
410 | … $null = Select-AzSubscription -Subscription $SubscriptionId
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Please provide a valid tenant or a valid subscription.
```

Contributor guide

Open the contributing guide

Research direction

Start with eng/common/TestResources/New-TestResources.ps1, especially the subscription-selection logic around line 410, and reproduce a locally splatted provisioner invocation without -CI. Compare the subscription-config path with the CI path; done means the local configuration selects a valid subscription without requiring the CI switch and no longer produces the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.