mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
[SQL Migration] Add storage/VM connectivity validation (#22982)
* Implement storage account connectivity check for SQL VM targets * Add missing break statement * Address PR comments
This commit is contained in:
@@ -571,8 +571,18 @@ export async function canTargetConnectToStorageAccount(
|
||||
|
||||
break;
|
||||
case MigrationTargetType.SQLVM:
|
||||
// to-do: VM scenario -- get subnet by first checking underlying compute VM, then its network interface
|
||||
return true;
|
||||
const targetVmNetworkInterfaces = Array.from((await NetworkInterfaceModel.getVmNetworkInterfaces(account, subscription, (targetServer as SqlVMServer))).values());
|
||||
const targetVmSubnets = targetVmNetworkInterfaces.map(networkInterface => {
|
||||
const ipConfigurations = networkInterface.properties.ipConfigurations ?? [];
|
||||
return ipConfigurations.map(ipConfiguration => ipConfiguration.properties.subnet.id.toLowerCase());
|
||||
}).flat();
|
||||
|
||||
// 2) check for access from whitelisted vnet
|
||||
if (storageAccountWhitelistedVNets.length > 0) {
|
||||
enabledFromWhitelistedVNet = storageAccountWhitelistedVNets.some(vnet => targetVmSubnets.some(targetVnet => vnet.toLowerCase() === targetVnet.toLowerCase()));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user