Skip to content

Commit 7fb1931

Browse files
azure-sdkheaths
andauthored
Allow logging into specific subscription (Azure#18723)
Resolves #1404 Co-authored-by: Heath Stewart <heaths@microsoft.com>
1 parent 044438e commit 7fb1931

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

eng/common/TestResources/New-TestResources.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ param (
3636
[ValidateNotNullOrEmpty()]
3737
[string] $TenantId,
3838

39-
[Parameter(ParameterSetName = 'Provisioner')]
39+
# Azure SDK Developer Playground subscription
40+
[Parameter()]
4041
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
41-
[string] $SubscriptionId,
42+
[string] $SubscriptionId = 'faa080af-c1d8-40ad-9cce-e1a450ca5b57',
4243

4344
[Parameter(ParameterSetName = 'Provisioner', Mandatory = $true)]
4445
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
@@ -141,8 +142,6 @@ try {
141142
$root = [System.IO.Path]::Combine($repositoryRoot, "sdk", $ServiceDirectory) | Resolve-Path
142143
$templateFileName = 'test-resources.json'
143144
$templateFiles = @()
144-
# Azure SDK Developer Playground
145-
$defaultSubscription = "faa080af-c1d8-40ad-9cce-e1a450ca5b57"
146145

147146
Write-Verbose "Checking for '$templateFileName' files under '$root'"
148147
Get-ChildItem -Path $root -Filter $templateFileName -Recurse | ForEach-Object {
@@ -202,7 +201,7 @@ try {
202201
$context = Get-AzContext;
203202
if (!$context) {
204203
Log "You are not logged in; connecting to 'Azure SDK Developer Playground'"
205-
$context = (Connect-AzAccount -Subscription $defaultSubscription).Context
204+
$context = (Connect-AzAccount -Subscription $SubscriptionId).Context
206205
}
207206

208207
# If no test application ID is specified during an interactive session, create a new service principal.
@@ -583,6 +582,8 @@ is passed to the ARM template as 'tenantId'.
583582
Optional subscription ID to use for new resources when logging in as a
584583
provisioner. You can also use Set-AzContext if not provisioning.
585584
585+
The default is the Azure SDK Developer Playground subscription ID.
586+
586587
.PARAMETER ProvisionerApplicationId
587588
The AAD Application ID used to provision test resources when a provisioner is
588589
specified.

eng/common/TestResources/New-TestResources.ps1.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,16 @@ Optional subscription ID to use for new resources when logging in as a
231231
provisioner.
232232
You can also use Set-AzContext if not provisioning.
233233
234+
The default is the Azure SDK Developer Playground subscription ID.
235+
234236
```yaml
235237
Type: String
236238
Parameter Sets: Provisioner
237239
Aliases:
238240

239241
Required: False
240242
Position: Named
241-
Default value: None
243+
Default value: faa080af-c1d8-40ad-9cce-e1a450ca5b57
242244
Accept pipeline input: False
243245
Accept wildcard characters: False
244246
```

0 commit comments

Comments
 (0)