diff --git a/pkg/cloudprovider/providers/azure/azure_standard.go b/pkg/cloudprovider/providers/azure/azure_standard.go index 7a42ab52cd6..0ebcff0210a 100644 --- a/pkg/cloudprovider/providers/azure/azure_standard.go +++ b/pkg/cloudprovider/providers/azure/azure_standard.go @@ -221,6 +221,10 @@ func getPrimaryInterfaceID(machine compute.VirtualMachine) (string, error) { } func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguration, error) { + if nic.IPConfigurations == nil { + return nil, fmt.Errorf("nic.IPConfigurations for nic (nicname=%q) is nil", *nic.Name) + } + if len(*nic.IPConfigurations) == 1 { return &((*nic.IPConfigurations)[0]), nil } @@ -231,7 +235,7 @@ func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguratio } } - return nil, fmt.Errorf("failed to determine the determine primary ipconfig. nicname=%q", *nic.Name) + return nil, fmt.Errorf("failed to determine the primary ipconfig. nicname=%q", *nic.Name) } func isInternalLoadBalancer(lb *network.LoadBalancer) bool {