{"record":{"id":"28e704d3c0ddbb30","repo":"kubernetes/kops","slug":"azure-storage-account-name-is-required","errorCode":null,"errorMessage":"Azure storage account name is required","messagePattern":"Azure storage account name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/azureclient.go","lineNumber":29,"sourceCode":"distributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\npackage vfs\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/Azure/azure-sdk-for-go/sdk/azidentity\"\n\t\"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob\"\n)\n\nfunc newAzureClient(ctx context.Context, accountName string) (*azblob.Client, error) {\n\tif accountName == \"\" {\n\t\treturn nil, fmt.Errorf(\"Azure storage account name is required\")\n\t}\n\n\turl := fmt.Sprintf(\"https://%s.blob.core.windows.net/\", accountName)\n\n\tcredential, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := azblob.NewClient(url, credential, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}\n","sourceCodeStart":11,"sourceCodeEnd":46,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/azureclient.go#L11-L46","documentation":"newAzureClient builds an azblob.Client pointed at https://<accountName>.blob.core.windows.net/. Because the URL and authentication are account-specific, an empty account name is rejected up front with this error before any credential or client construction, and it is surfaced through getAzureBlobClient.","triggerScenarios":"getAzureBlobClient (or any caller of newAzureClient) invoked with an empty accountName string — typically when the storage account was never configured in the kops cluster spec or the Azure cloud discovery returned no account.","commonSituations":"Running kops against an Azure cluster whose Azure storage account config is missing/empty; env vars like AZURE_STORAGE_ACCOUNT unset when constructing a VFS client manually; misparsed Azure config where the account field defaults to \"\".","solutions":["Configure the Azure storage account name in the kops cluster spec (Cluster.Spec.ConfigStore / azure configuration)","Set AZURE_STORAGE_ACCOUNT in the environment if the account is sourced from env","Check the code path that derives accountName and fix empty/missing config resolution","Re-run the kops command after the account name is populated"],"exampleFix":"// before\nclient, err := getAzureBlobClient(ctx, os.Getenv(\"AZURE_STORAGE_ACCOUNT\"))\n\n// after\naccount := os.Getenv(\"AZURE_STORAGE_ACCOUNT\")\nif account == \"\" {\n\treturn nil, fmt.Errorf(\"AZURE_STORAGE_ACCOUNT env var must be set to use Azure VFS\")\n}\nclient, err := getAzureBlobClient(ctx, account)","handlingStrategy":"validation","validationCode":"account := os.Getenv(\"AZURE_STORAGE_ACCOUNT\")\nif account == \"\" {\n\treturn nil, fmt.Errorf(\"Azure storage account name is required: set AZURE_STORAGE_ACCOUNT or configure it in the cluster spec\")\n}","typeGuard":null,"tryCatchPattern":"client, err := getAzureBlobClient(ctx, accountName)\nif err != nil {\n\tif strings.Contains(err.Error(), \"account name is required\") {\n\t\treturn nil, fmt.Errorf(\"Azure VFS not configured: missing storage account name: %w\", err)\n\t}\n\treturn nil, err\n}","preventionTips":["Validate required Azure settings (account name, subscription, resource group) at startup before any VFS operations","Source the account name from a single, checked config path instead of ad-hoc env reads","Add a unit test asserting getAzureBlobClient fails fast on empty account with a clear message"],"tags":["azure","storage","configuration","validation"],"backgroundTag":"missing-config-value","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"}