{"record":{"id":"bc2b9c35d62e7912","repo":"kubernetes/kops","slug":"creating-public-ip-addresses-client-w","errorCode":null,"errorMessage":"creating public ip addresses client: %w","messagePattern":"creating public ip addresses client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/publicipaddress.go","lineNumber":89,"sourceCode":"\t}\n\treturn l, nil\n}\n\nfunc (c *publicIPAddressesClientImpl) Delete(ctx context.Context, resourceGroupName, publicIPAddressName string) error {\n\tfuture, err := c.c.BeginDelete(ctx, resourceGroupName, publicIPAddressName, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deleting public ip address: %w\", err)\n\t}\n\tif _, err := future.PollUntilDone(ctx, nil); err != nil {\n\t\treturn fmt.Errorf(\"waiting for public ip address deletion completion: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc newPublicIPAddressesClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*publicIPAddressesClientImpl, error) {\n\tc, err := network.NewPublicIPAddressesClient(subscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating public ip addresses client: %w\", err)\n\t}\n\treturn &publicIPAddressesClientImpl{\n\t\tc: c,\n\t}, nil\n}\n","sourceCodeStart":71,"sourceCodeEnd":95,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/publicipaddress.go#L71-L95","documentation":"Wraps the failure of network.NewPublicIPAddressesClient, the azsdk client constructor. This client can fail construction because it must resolve an ARM endpoint and pipeline from the provided options; with nil options it typically fails only when subscriptionID is empty or credentials/options are invalid.","triggerScenarios":"newPublicIPAddressesClientImpl(subscriptionID, cred) is called (from newAzureCloud) with an empty subscription ID or a cred/options combination the SDK cannot build a pipeline for.","commonSituations":"--cloud-provider=azure configured without a subscription ID in the kOps cluster spec; AZURE_SUBSCRIPTION_ID unset/empty when building cloud via DefaultAzureCredential chain.","solutions":["Ensure a non-empty subscription ID is passed (check the cluster spec / AZURE_SUBSCRIPTION_ID)","Verify the azidentity.DefaultAzureCredential was constructed without error before this call","Check the Azure SDK module version for constructor API changes after an upgrade","Re-run with AZURE_CLIENT_ID/SECRET/TENANT set if relying on environment credentials"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func validateAzureConfig(subscriptionID string) error {\n  if strings.TrimSpace(subscriptionID) == \"\" {\n    return errors.New(\"azure: subscription ID must be set (AZURE_SUBSCRIPTION_ID or cluster spec)\")\n  }\n  return nil\n}","typeGuard":"func clientConstructionFailed(err error) (bool, error) {\n  var re *azcore.ResponseError\n  if errors.As(err, &re) { return true, re }\n  return err != nil, err\n}","tryCatchPattern":"c, err := newPublicIPAddressesClientImpl(subID, cred)\nif err != nil {\n  return nil, fmt.Errorf(\"azure cloud init failed, check subscription ID and credentials: %w\", err)\n}","preventionTips":["Fail fast on empty AZURE_SUBSCRIPTION_ID before constructing cloud clients","Construct DefaultAzureCredential separately and check its error first","Pin azure-sdk-for-go module versions and read upgrade notes","Validate config with 'az account show' in preflight checks"],"tags":["azure","client-construction","configuration"],"backgroundTag":"azure-client-init-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}