Skip to content

Commit

Permalink
fix bug if virtualNetwork is in a different resource group fixes #8407
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfredo Santamaria Gomez committed Jul 19, 2019
1 parent 07f13b3 commit bd614ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/ServiceFabric/ServiceFabric/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
- Additional information about change #1
-->
## Upcoming Release
* Fix add node type NullReferenceException bug when resource group had other vmss not related to the service fabric cluster. Fixes issue: https://github.com/Azure/azure-powershell/issues/8681
* Fix add node type cmdlet bugs
-NullReferenceException bug when resource group had other vmss not related to the service fabric cluster. Fixes issue: https://github.com/Azure/azure-powershell/issues/8681
- Fix bug where cmdlet failed if virtualNetwork was in a different resource group that the cluser. fixes issue: https://github.com/Azure/azure-powershell/issues/8407

## Version 1.1.1
* Fix add certificate ByExistingKeyVault getting the wrong thumbprint in some cases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,18 +623,20 @@ private string GetSubnetAddressPrefix(VirtualMachineScaleSetIPConfiguration ipCo
var subnetId = ipConfiguration.Subnet.Id;
var segments = subnetId.Split('/');
if (!segments[segments.Length - 2].Equals("subnets", StringComparison.OrdinalIgnoreCase) ||
!segments[segments.Length - 4].Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase))
!segments[segments.Length - 4].Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase) ||
!segments[segments.Length - 8].Equals("resourceGroups", StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException(
string.Format(
ServiceFabricProperties.Resources.InvalidNetworkNameInResourceId,
subnetId));
}

var subNetRG = segments[segments.Length - 7];
var subnetName = segments[segments.Length - 1];
var virtualNetworkName = segments[segments.Length - 3];

var subnet = NetworkManagementClient.Subnets.Get(this.ResourceGroupName, virtualNetworkName, subnetName);
var subnet = NetworkManagementClient.Subnets.Get(subNetRG, virtualNetworkName, subnetName);
return subnet.AddressPrefix;
}
}
Expand Down

0 comments on commit bd614ba

Please sign in to comment.