{"record":{"id":"21e18d7f0b01554e","repo":"kubernetes/kops","slug":"azure-subscription-id-is-required","errorCode":null,"errorMessage":"--azure-subscription-id is required","messagePattern":"--azure-subscription-id is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/create_cluster.go","lineNumber":585,"sourceCode":"\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tcluster = nil\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif cluster != nil {\n\t\t\treturn fmt.Errorf(\"cluster %q already exists; use 'kops update cluster' to apply changes\", c.ClusterName)\n\t\t}\n\t}\n\n\tif c.OpenstackNetworkID != \"\" {\n\t\tc.NetworkID = c.OpenstackNetworkID\n\t}\n\n\tif featureflag.Azure.Enabled() {\n\t\tif c.CloudProvider == \"azure\" && c.AzureSubscriptionID == \"\" {\n\t\t\treturn fmt.Errorf(\"--azure-subscription-id is required\")\n\t\t}\n\t}\n\n\tclusterResult, err := cloudup.NewCluster(&c.NewClusterOptions, clientset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcluster := clusterResult.Cluster\n\tinstanceGroups := clusterResult.InstanceGroups\n\n\tvar controlPlanes []*api.InstanceGroup\n\tvar nodes []*api.InstanceGroup\n\tfor _, ig := range instanceGroups {\n\t\tswitch {\n\t\tcase ig.Spec.Role.HasControlPlane():\n\t\t\tcontrolPlanes = append(controlPlanes, ig)\n\t\tcase ig.Spec.Role.HasNode():","sourceCodeStart":567,"sourceCodeEnd":603,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_cluster.go#L567-L603","documentation":"When the Azure feature flag is enabled and the chosen cloud provider is 'azure', RunCreateCluster requires an Azure subscription ID; missing it fails with '--azure-subscription-id is required'. This is an explicit provider-specific precondition check before cluster creation.","triggerScenarios":"Running `kops create cluster --cloud azure` (with KOPS_FEATURE_FLAGS=Azure) without --azure-subscription-id, leaving c.AzureSubscriptionID empty.","commonSituations":"Testing Azure support without exporting AZURE_SUBSCRIPTION_ID; copying AWS/GCP command lines to Azure; feature flag enabled in CI but Azure options not passed.","solutions":["Pass --azure-subscription-id <id> to create cluster","Set the AZURE_SUBSCRIPTION_ID environment variable (picked up by the flag default)","Disable the Azure feature flag if not intentionally targeting Azure","Verify the subscription ID is a valid GUID from `az account show`"],"exampleFix":"// before\nKOPS_FEATURE_FLAGS=Azure kops create cluster ... --cloud azure\n// after\nKOPS_FEATURE_FLAGS=Azure kops create cluster ... --cloud azure --azure-subscription-id 00000000-0000-0000-0000-000000000000","handlingStrategy":"validation","validationCode":"if cloudProvider == \"azure\" && azureSubscriptionID == \"\" {\n\tazureSubscriptionID = os.Getenv(\"AZURE_SUBSCRIPTION_ID\")\n}\nif cloudProvider == \"azure\" && azureSubscriptionID == \"\" {\n\treturn fmt.Errorf(\"azure requires --azure-subscription-id\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Export AZURE_SUBSCRIPTION_ID for Azure feature-flag testing","Use `az account show --query id -o tsv` to get the correct GUID","Keep Azure-specific flags in your cloud-specific script path"],"tags":["cli","azure","validation"],"backgroundTag":"missing-required-flag","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"}