From d76cdf4c6dd6e4fb097dff846eabec05db139d94 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 12 Feb 2021 12:29:16 -0800 Subject: [PATCH] Allow logging into specific subscription (#1681) Resolves #1404 Co-authored-by: Heath Stewart --- eng/common/TestResources/New-TestResources.ps1 | 11 ++++++----- eng/common/TestResources/New-TestResources.ps1.md | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 25f0b18c3..2692fee56 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -36,9 +36,10 @@ param ( [ValidateNotNullOrEmpty()] [string] $TenantId, - [Parameter(ParameterSetName = 'Provisioner')] + # Azure SDK Developer Playground subscription + [Parameter()] [ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')] - [string] $SubscriptionId, + [string] $SubscriptionId = 'faa080af-c1d8-40ad-9cce-e1a450ca5b57', [Parameter(ParameterSetName = 'Provisioner', Mandatory = $true)] [ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')] @@ -141,8 +142,6 @@ try { $root = [System.IO.Path]::Combine($repositoryRoot, "sdk", $ServiceDirectory) | Resolve-Path $templateFileName = 'test-resources.json' $templateFiles = @() - # Azure SDK Developer Playground - $defaultSubscription = "faa080af-c1d8-40ad-9cce-e1a450ca5b57" Write-Verbose "Checking for '$templateFileName' files under '$root'" Get-ChildItem -Path $root -Filter $templateFileName -Recurse | ForEach-Object { @@ -202,7 +201,7 @@ try { $context = Get-AzContext; if (!$context) { Log "You are not logged in; connecting to 'Azure SDK Developer Playground'" - $context = (Connect-AzAccount -Subscription $defaultSubscription).Context + $context = (Connect-AzAccount -Subscription $SubscriptionId).Context } # 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'. Optional subscription ID to use for new resources when logging in as a provisioner. You can also use Set-AzContext if not provisioning. +The default is the Azure SDK Developer Playground subscription ID. + .PARAMETER ProvisionerApplicationId The AAD Application ID used to provision test resources when a provisioner is specified. diff --git a/eng/common/TestResources/New-TestResources.ps1.md b/eng/common/TestResources/New-TestResources.ps1.md index 096c7e70a..4cd4ab8f0 100644 --- a/eng/common/TestResources/New-TestResources.ps1.md +++ b/eng/common/TestResources/New-TestResources.ps1.md @@ -231,6 +231,8 @@ Optional subscription ID to use for new resources when logging in as a provisioner. You can also use Set-AzContext if not provisioning. +The default is the Azure SDK Developer Playground subscription ID. + ```yaml Type: String Parameter Sets: Provisioner @@ -238,7 +240,7 @@ Aliases: Required: False Position: Named -Default value: None +Default value: faa080af-c1d8-40ad-9cce-e1a450ca5b57 Accept pipeline input: False Accept wildcard characters: False ```