Skip to content

Commit

Permalink
Revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lee committed Jan 25, 2024
1 parent f6da053 commit 407367a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
43 changes: 22 additions & 21 deletions src/Migrate/Migrate.Autorest/custom/Helper/CommonHelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,28 @@ function GetHCIClusterARGQuery {
)

process {
$query = "resources | where type == 'microsoft.extendedlocation/customlocations'"
$query += "| mv-expand ClusterId = properties['clusterExtensionIds']"
$query += "| extend ClusterId = toupper(tostring(ClusterId))"
$query += "| extend CustomLocation = toupper(tostring(id))"
$query += "| extend resourceBridgeID = toupper(tostring(properties['hostResourceId']))"
$query += "| extend customLocationRegion = location"
$query += "| join ("
$query += "kubernetesconfigurationresources"
$query += "| where type == 'microsoft.kubernetesconfiguration/extensions'"
$query += "| where properties['ConfigurationSettings']['HCIClusterID'] =~ '$HCIClusterID'"
$query += "| project ClusterId = id"
$query += "| extend ClusterId = toupper(tostring(ClusterId))"
$query += ") on ClusterId"
$query += "| join ("
$query += "resources"
$query += "| where type == 'microsoft.resourceconnector/appliances'"
$query += "| where properties['provisioningState'] == 'Succeeded'"
$query += "| extend statusOfTheBridge = properties['status']"
$query += "| extend resourceBridgeID = toupper(tostring(id))"
$query += ") on resourceBridgeID"

$query = @"
resources | where type == 'microsoft.extendedlocation/customlocations'
| mv-expand ClusterId = properties['clusterExtensionIds']
| extend ClusterId = toupper(tostring(ClusterId))
| extend CustomLocation = toupper(tostring(id))
| extend resourceBridgeID = toupper(tostring(properties['hostResourceId']))
| extend customLocationRegion = location
| join (
kubernetesconfigurationresources
| where type == 'microsoft.kubernetesconfiguration/extensions'
| where properties['ConfigurationSettings']['HCIClusterID'] =~ '$HCIClusterID'
| project ClusterId = id
| extend ClusterId = toupper(tostring(ClusterId))
) on ClusterId
| join (
resources
| where type == 'microsoft.resourceconnector/appliances'
| where properties['provisioningState'] == 'Succeeded'
| extend statusOfTheBridge = properties['status']
| extend resourceBridgeID = toupper(tostring(id))
) on resourceBridgeID
"@
return $query
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Initialize-AzMigrateHCIReplicationInfrastructure {
process {
Import-Module $PSScriptRoot\Helper\AzStackHCICommonSettings.ps1
Import-Module $PSScriptRoot\Helper\CommonHelper.ps1

CheckResourcesModuleDependency
CheckStorageModuleDependency
Import-Module Az.Resources
Expand Down Expand Up @@ -878,7 +878,7 @@ function Initialize-AzMigrateHCIReplicationInfrastructure {

# Remove replication extension if does not match the selected Cache Storage Account
if ($null -ne $replicationExtension -and $replicationExtension.Property.CustomProperty.StorageAccountId -ne $cacheStorageAccount.Id) {
Write-Host "Replication Extension '$($replicationExtensionName)' found but linked to a different Cache Storage Account '$($replicationExtension.Property.CustomProperty.StorageAccountId)'.`nRemoving Replication Extension..."
Write-Host "Replication Extension '$($replicationExtensionName)' found but linked to a different Cache Storage Account '$($replicationExtension.Property.CustomProperty.StorageAccountId)'."

try {
Az.Migrate.Internal\Remove-AzMigrateReplicationExtension -InputObject $replicationExtension | Out-Null
Expand All @@ -889,7 +889,8 @@ function Initialize-AzMigrateHCIReplicationInfrastructure {
}
}

Start-Sleep -Seconds 30
Write-Host "Removing Replication Extension and waiting for 2 minutes..."
Start-Sleep -Seconds 120
$replicationExtension = Az.Migrate.Internal\Get-AzMigrateReplicationExtension `
-InputObject $replicationExtension `
-ErrorVariable notPresent `
Expand Down

0 comments on commit 407367a

Please sign in to comment.