Ensure multiple subscriptions can be moved to a management in parallel (#288)
Ensure deployment name for moving subscription is unique
This commit is contained in:
Родитель
93d2f13847
Коммит
c4133077e1
|
@ -14,7 +14,7 @@ on:
|
|||
inputs:
|
||||
subscriptionIds:
|
||||
type: string
|
||||
description: Subscription ID(s) (optional), e.g. "abcd", "1234"
|
||||
description: Subscription ID(s), e.g. "abcd", "1234"
|
||||
required: true
|
||||
environmentName:
|
||||
type: string
|
||||
|
|
|
@ -84,25 +84,30 @@ function Set-Subscriptions {
|
|||
Write-Output "Creating new file with runtime populated parameters: $PopulatedParametersFilePath"
|
||||
$Configuration | ConvertTo-Json -Depth 100 | Set-Content $PopulatedParametersFilePath
|
||||
|
||||
$MoveDeploymentName="move-subscription-$SubscriptionId-$DeploymentRegion"
|
||||
$MoveDeploymentName=-join $MoveDeploymentName[0..63]
|
||||
|
||||
Write-Output "Moving Subscription ($SubscriptionId) to Management Group ($ManagementGroupId)"
|
||||
New-AzManagementGroupDeployment `
|
||||
-Name $MoveDeploymentName `
|
||||
-ManagementGroupId $ManagementGroupId `
|
||||
-Location $Context.DeploymentRegion `
|
||||
-TemplateFile "$($Context.WorkingDirectory)/landingzones/utils/mg-move/move-subscription.bicep" `
|
||||
-TemplateParameterObject @{
|
||||
managementGroupId = $ManagementGroupId
|
||||
subscriptionId = $SubscriptionId
|
||||
}
|
||||
} `
|
||||
-Verbose
|
||||
|
||||
Write-Output "Deploying $PopulatedParametersFilePath to $SubscriptionId in $Region"
|
||||
Write-Output "Deploying $PopulatedParametersFilePath to $SubscriptionId in $Region"
|
||||
|
||||
Set-AzContext -Subscription $SubscriptionId
|
||||
New-AzSubscriptionDeployment `
|
||||
-Name "main-$DeploymentRegion" `
|
||||
-Location $DeploymentRegion `
|
||||
-TemplateFile "$($Context.WorkingDirectory)/landingzones/lz-$ArchetypeName/main.bicep" `
|
||||
-TemplateParameterFile $PopulatedParametersFilePath `
|
||||
-Verbose
|
||||
Set-AzContext -Subscription $SubscriptionId
|
||||
New-AzSubscriptionDeployment `
|
||||
-Name "main-$DeploymentRegion" `
|
||||
-Location $DeploymentRegion `
|
||||
-TemplateFile "$($Context.WorkingDirectory)/landingzones/lz-$ArchetypeName/main.bicep" `
|
||||
-TemplateParameterFile $PopulatedParametersFilePath `
|
||||
-Verbose
|
||||
|
||||
Remove-Item $PopulatedParametersFilePath
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче