Skip to content

Commit 538ed20

Browse files
authored
Merge pull request #531 from Azure/user/rakku/lx-registration
Connected registration for CustomCloud
2 parents 56ab685 + cf84176 commit 538ed20

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Registration/RegisterWithAzure.psm1

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ function Set-AzsRegistration{
175175
[String] $ResourceGroupName = 'azurestack',
176176

177177
[Parameter(Mandatory = $false)]
178-
[String] $ResourceGroupLocation = 'westcentralus',
178+
[String] $ResourceGroupLocation = @{'AzureCloud'='westcentralus';
179+
'AzureChinaCloud'='ChinaEast';
180+
'AzureUSGovernment'='usgovvirginia';
181+
'CustomCloud'='westcentralus'}[$AzureContext.Environment.Name],
179182

180183
[Parameter(Mandatory = $false)]
181184
[ValidateSet('Capacity', 'PayAsYouUse', 'Development')]
@@ -230,9 +233,8 @@ function Set-AzsRegistration{
230233

231234
# Register environment with Azure
232235

233-
# Set resource group location based on environment
234-
$CustomResourceGroupLocation = Set-ResourceGroupLocation -AzureEnvironment $AzureContext.Environment.Name -ResourceGroupLocation $ResourceGroupLocation
235-
New-RegistrationResource -ResourceGroupName $ResourceGroupName -ResourceGroupLocation $CustomResourceGroupLocation -RegistrationToken $RegistrationToken -RegistrationName $RegistrationName
236+
Log-Output "Creating registration resource at ResourceGroupLocation: $ResourceGroupLocation"
237+
New-RegistrationResource -ResourceGroupName $ResourceGroupName -ResourceGroupLocation $ResourceGroupLocation -RegistrationToken $RegistrationToken -RegistrationName $RegistrationName
236238

237239
# Assign custom RBAC role
238240
Log-Output "Assigning custom RBAC role to resource $RegistrationName"
@@ -1431,14 +1433,6 @@ function Get-AzureAccountInfo{
14311433
Tenant = $AzureContext.Tenant
14321434
}
14331435

1434-
if (($AzureContext.Environment.name -ne 'AzureChinaCloud') -and ($AzureContext.Environment.name -ne 'AzureUsGovernment'))
1435-
{
1436-
if ($AzureContext.Environment.name -ne 'AzureCloud')
1437-
{
1438-
Log-Throw "The provided Azure Environment is not supported for registration: $($AzureContext.Environment.name )" -CallingFunction $PSCmdlet.MyInvocation.MyCommand.Name
1439-
}
1440-
}
1441-
14421436
if (-not($AzureContext.Subscription))
14431437
{
14441438
Log-Output "Current Azure context:`r`n$(ConvertTo-Json $azureContextDetails)"

0 commit comments

Comments
 (0)