You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
az / azurerm
issue ServiceFabric/.../AddAzureRmServiceFabricNodeType.cs GetProfiles() NullReferenceException.
Issue is caused by having an existing vm scale set with no extensions deployed in the same resource group as the service fabric cluster being modified by the add-azServiceFabricNodeType add-azureRMServiceFabricNodeType commands.
tested fix below is to not assume any extensions exist:
varext= vm.VirtualMachineProfile.ExtensionProfile?.Extensions.FirstOrDefault(e =>string.Equals( e.Type, Constants.ServiceFabricWindowsNodeExtName, StringComparison.OrdinalIgnoreCase));// Try to get Linux extif(ext==null){ext= vm.VirtualMachineProfile.ExtensionProfile?.Extensions.FirstOrDefault(e => e.Type.Equals( Constants.ServiceFabricLinuxNodeExtName, StringComparison.OrdinalIgnoreCase));}if(ext!=null){existingFabricExtension=ext;osProfile= vm.VirtualMachineProfile.OsProfile;existingStorageProfile= vm.VirtualMachineProfile.StorageProfile;existingNetworkProfile= vm.VirtualMachineProfile.NetworkProfile;}
ext = vm.VirtualMachineProfile.ExtensionProfile?.Extensions.FirstOrDefault(
e =>
fix however may be to also not enumerate vm scale sets that are not part of existing cluster being modified.
asking pg as there are similar workitems where all scale sets are being enumerated in resource group
Steps to reproduce
create new service fabric cluster in new resource group using defaults in portal
create new virtual machine scale set in same resource group using defaults in portal
(the vmss will not have any extensions installed and is what produces this issue)
run powershell command to add a new service fabric node type using example below.
# assumes existing cluster and existing scaleset with no extensions created with steps above$VerbosePreference=$DebugPreference="continue"$pwd=ConvertTo-SecureString-String 'Password$123456'-AsPlainText -Force
Add-AzServiceFabricNodeType-ResourceGroupName $resourceGroupName-Name $clusterName-Capacity 5-VmUserName $adminUserName-NodeType $newNodeTypeName-VmPassword $pwd
EXPECTED RESULTS:
a new nodetype (vm scale set) should be created in existing resource group and joined to cluster
ACTUAL RESULTS:
Add-AzServiceFabricNodeType : Object reference not set to an instance of an object.
At line:1 char:1+Add-AzServiceFabricNodeType-ResourceGroupName sfjagilber1nt1 -Name s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzServiceFabricNodeType], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ServiceFabric.Commands.AddAzureRmServiceFabricNodeType
DEBUG: AzureQoSEvent: CommandName - Add-AzServiceFabricNodeType; IsSuccess - False; Duration - 00:00:00.7871233; Exception - System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Azure.Commands.ServiceFabric.Commands.AddAzureRmServiceFabricNodeType.GetProfiles(VirtualMachineScaleSetExtensionProfile& vmExtProfile, VirtualMachineScaleSetOSProfile& osProfile, VirtualMachineScaleSetStorageProfile& storageProfile, VirtualMachineScaleSetNetworkProfile& networkProfile)
at Microsoft.Azure.Commands.ServiceFabric.Commands.AddAzureRmServiceFabricNodeType.CreateVmss()
at Microsoft.Azure.Commands.ServiceFabric.Commands.AddAzureRmServiceFabricNodeType.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 2:57:06 PM - AddAzureRmServiceFabricNodeType end processing.
DEBUG: 2:57:06 PM - AddAzureRmServiceFabricNodeType end processing.
Environment data
PS G:\github\azure-powershell\artifacts\Debug\Az.ServiceFabric> $psversiontable
Name Value
---- -----
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Error output
The text was updated successfully, but these errors were encountered:
Description
az / azurerm
issue ServiceFabric/.../AddAzureRmServiceFabricNodeType.cs GetProfiles() NullReferenceException.
Issue is caused by having an existing vm scale set with no extensions deployed in the same resource group as the service fabric cluster being modified by the add-azServiceFabricNodeType add-azureRMServiceFabricNodeType commands.
tested fix below is to not assume any extensions exist:
azure-powershell/src/ServiceFabric/ServiceFabric/Commands/AddAzureRmServiceFabricNodeType.cs
Lines 237 to 263 in 1040846
jagilber@21ef225
fix however may be to also not enumerate vm scale sets that are not part of existing cluster being modified.
asking pg as there are similar workitems where all scale sets are being enumerated in resource group
Steps to reproduce
create new service fabric cluster in new resource group using defaults in portal
create new virtual machine scale set in same resource group using defaults in portal
(the vmss will not have any extensions installed and is what produces this issue)
run powershell command to add a new service fabric node type using example below.
EXPECTED RESULTS:
a new nodetype (vm scale set) should be created in existing resource group and joined to cluster
ACTUAL RESULTS:
Module versions
Debug output
Environment data
Error output
The text was updated successfully, but these errors were encountered: