Skip to content

Commit

Permalink
Fix recovery parameter sets (#123)
Browse files Browse the repository at this point in the history
* fix carlm params

* added vmss backup state file path to log

* corrected recovery parameter sets

* version bump
  • Loading branch information
mbrat2005 authored Jun 3, 2024
1 parent c44b6e6 commit 2210dea
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'AzureBasicLoadBalancerUpgrade'

# Version number of this module.
ModuleVersion = '2.4.9'
ModuleVersion = '2.4.10'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -107,7 +107,7 @@
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'Add secondary external LB outbound option'
ReleaseNotes = 'Fixed recovery parameter sets'

# Prerelease string of this module
# Prerelease = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ Function BackupVmss {
$options.MaxDepth = 64

[System.Text.Json.JsonSerializer]::Serialize($vmss, [Microsoft.Azure.Commands.Compute.Automation.Models.PSVirtualMachineScaleSet], $options) | Out-File -FilePath $outputFilePathVSS

$message = "[BackupVmss] JSON backup VMSS to file '$outputFilePathVSS' Completed"
log -Message $message -Severity Information
}
catch {
# catch issue where PowerShell Desktop cannot serialize complex objects in VM extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,22 @@ function Start-AzBasicLoadBalancerUpgrade {
[Parameter(Mandatory = $True, ParameterSetName = 'ByName')][string] $ResourceGroupName,
[Parameter(Mandatory = $True, ParameterSetName = 'ByName')][string] $BasicLoadBalancerName,
[Parameter(Mandatory = $True, ValueFromPipeline, ParameterSetName = 'ByObject')][Microsoft.Azure.Commands.Network.Models.PSLoadBalancer] $BasicLoadBalancer,
[Parameter(Mandatory = $True, ParameterSetName = 'ByJsonVm')][string]
[Parameter(Mandatory = $false, ParameterSetName = 'ByJsonVmss')][string]$FailedMigrationRetryFilePathLB,
[Parameter(Mandatory = $false, ParameterSetName = 'ByJsonVmss')][string] $FailedMigrationRetryFilePathVMSS,
[Parameter(Mandatory = $True, ParameterSetName = 'VMRecovery')][string]
[Parameter(Mandatory = $True, ParameterSetName = 'VmssRecovery')][string]$FailedMigrationRetryFilePathLB,
[Parameter(Mandatory = $True, ParameterSetName = 'VmssRecovery')][string] $FailedMigrationRetryFilePathVMSS,
[Parameter(Mandatory = $false, ParameterSetName = 'ValidateCompletedMigration')][string]
[Parameter(Mandatory = $false, ParameterSetName = 'ByName')][string]
[Parameter(Mandatory = $false, ParameterSetName = 'ByObject')][string]
[Parameter(Mandatory = $false, ParameterSetName = 'ByJsonVm')][string]
[Parameter(Mandatory = $false, ParameterSetName = 'ByJsonVmss')][string] $StandardLoadBalancerName,
[Parameter(Mandatory = $false, ParameterSetName = 'VMRecovery')][string]
[Parameter(Mandatory = $false, ParameterSetName = 'VmssRecovery')][string] $StandardLoadBalancerName,
[Parameter(Mandatory = $false)][string] $RecoveryBackupPath = $pwd,
[Parameter(Mandatory = $false)][switch] $FollowLog,
[Parameter(Mandatory = $false)][switch] $validateScenarioOnly,
[Parameter(Mandatory = $True, ParameterSetName = 'MultiLB')][psobject[]] $multiLBConfig, # @(@{basicLoadBalancer=<[Microsoft.Azure.Commands.Network.Models.PSLoadBalancer]>[;standardLoadBalancerName='lb-standard-01']})
[Parameter(Mandatory = $false, ParameterSetName = 'ByName')][switch]
[Parameter(Mandatory = $false, ParameterSetName = 'ByObject')][switch]
[Parameter(Mandatory = $false, ParameterSetName = 'ByJsonVmss')][switch]
[Parameter(Mandatory = $false, ParameterSetName = 'VmssRecovery')][switch]
[Parameter(Mandatory = $false, ParameterSetName = 'VMRecovery')][switch]
[Parameter(Mandatory = $false, ParameterSetName = 'MultiLB')][switch]
[Parameter(Mandatory = $false, ParameterSetName = 'ValidateCompletedMigration')][switch]$skipUpgradeNATPoolsToNATRules,
[Parameter(Mandatory = $true, ParameterSetName = 'ValidateCompletedMigration')][switch] $validateCompletedMigration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ param maxUnhealthyUpgradedInstancePercent int = 20
param pauseTimeBetweenBatches string = 'PT0S'

@description('Optional. Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, enableAutomaticUpdates is automatically set to false and cannot be set to true.')
param enableAutomaticOSUpgrade bool = true
param enableAutomaticOSUpgrade bool = false

@description('Optional. Whether OS image rollback feature should be disabled.')
param disableAutomaticRollback bool = false
Expand Down Expand Up @@ -335,7 +335,7 @@ var identity = identityType != 'None' ? {

var enableReferencedModulesTelemetry = false

resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) {
/* resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) {
name: 'pid-47ed15a6-730a-4827-bcb4-0fd963ffbd82-${uniqueString(deployment().name, location)}'
properties: {
mode: 'Incremental'
Expand All @@ -345,7 +345,7 @@ resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (ena
resources: []
}
}
}
} */

resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2022-03-01' = {
name: name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ param maxUnhealthyUpgradedInstancePercent int = 20
param pauseTimeBetweenBatches string = 'PT0S'

@description('Optional. Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, enableAutomaticUpdates is automatically set to false and cannot be set to true.')
param enableAutomaticOSUpgrade bool = true
param enableAutomaticOSUpgrade bool = false

@description('Optional. Whether OS image rollback feature should be disabled.')
param disableAutomaticRollback bool = false
Expand Down Expand Up @@ -338,7 +338,7 @@ var identity = identityType != 'None' ? {

var enableReferencedModulesTelemetry = false

resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) {
/* resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (enableDefaultTelemetry) {
name: 'pid-47ed15a6-730a-4827-bcb4-0fd963ffbd82-${uniqueString(deployment().name, location)}'
properties: {
mode: 'Incremental'
Expand All @@ -348,7 +348,7 @@ resource defaultTelemetry 'Microsoft.Resources/deployments@2021-04-01' = if (ena
resources: []
}
}
}
} */

resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2022-03-01' = {
name: name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ module vm_azureDiskEncryptionExtension 'extensions/deploy.bicep' = if (extension
]
}

module vm_backup '../../Microsoft.RecoveryServices/vaults/protectionContainers/protectedItems/deploy.bicep' = if (!empty(backupVaultName)) {
/* module vm_backup '../../Microsoft.RecoveryServices/vaults/protectionContainers/protectedItems/deploy.bicep' = if (!empty(backupVaultName)) {
name: '${uniqueString(deployment().name, location)}-VM-Backup'
params: {
name: 'vm;iaasvmcontainerv2;${resourceGroup().name};${vm.name}'
Expand All @@ -699,7 +699,7 @@ module vm_backup '../../Microsoft.RecoveryServices/vaults/protectionContainers/p
vm_desiredStateConfigurationExtension
vm_customScriptExtension
]
}
} */

resource vm_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock)) {
name: '${vm.name}-${lock}-lock'
Expand Down

0 comments on commit 2210dea

Please sign in to comment.