{"record":{"id":"a5f2d12513b854c2","repo":"VictoriaMetrics/VictoriaMetrics","slug":"missing-azure-storage-account-name-environment-var","errorCode":null,"errorMessage":"missing AZURE_STORAGE_ACCOUNT_NAME environment variable when AZURE_STORAGE_ACCOUNT_KEY is set; see https://docs.victoriametrics.com/victoriametrics/vmbackup/#providing-credentials-via-env-variables","messagePattern":"missing AZURE_STORAGE_ACCOUNT_NAME environment variable when AZURE_STORAGE_ACCOUNT_KEY is set; see https://docs\\.victoriametrics\\.com/victoriametrics/vmbackup/#providing-credentials-via-env-variables","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/backup/azremote/azblob.go","lineNumber":93,"sourceCode":"\tfs.metadata = meta\n\n\treturn nil\n}\n\nfunc (fs *FS) newClient() (*service.Client, error) {\n\tconnString := fs.env(\"AZURE_STORAGE_ACCOUNT_CONNECTION_STRING\")\n\tif connString != \"\" {\n\t\tlogger.Infof(\"creating AZBlob service client from connection string defined at AZURE_STORAGE_ACCOUNT_CONNECTION_STRING\")\n\t\treturn service.NewClientFromConnectionString(connString, nil)\n\t}\n\n\taccountKey := fs.env(\"AZURE_STORAGE_ACCOUNT_KEY\")\n\tif accountKey != \"\" {\n\t\tlogger.Infof(\"creating AZBlob service client from account name and key\")\n\n\t\taccountName := fs.env(\"AZURE_STORAGE_ACCOUNT_NAME\")\n\t\tif accountName == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"missing AZURE_STORAGE_ACCOUNT_NAME environment variable when AZURE_STORAGE_ACCOUNT_KEY is set; \" +\n\t\t\t\t\"see https://docs.victoriametrics.com/victoriametrics/vmbackup/#providing-credentials-via-env-variables\")\n\t\t}\n\t\tcreds, err := azblob.NewSharedKeyCredential(accountName, accountKey)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create Shared Key credentials: %w\", err)\n\t\t}\n\t\tserviceURL := fs.getServiceURL(accountName)\n\t\treturn service.NewClientWithSharedKeyCredential(serviceURL, creds, nil)\n\t}\n\n\tuseDefault := fs.env(\"AZURE_USE_DEFAULT_CREDENTIAL\")\n\tif useDefault == \"true\" {\n\t\tlogger.Infof(\"creating AZBlob service client from default credentials\")\n\t\tcreds, err := azidentity.NewDefaultAzureCredential(nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create default Azure credentials: %w\", err)\n\t\t}\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/backup/azremote/azblob.go#L75-L111","documentation":"When newClient sees AZURE_STORAGE_ACCOUNT_KEY set, it requires AZURE_STORAGE_ACCOUNT_NAME too, since SharedKey auth needs both. If the name is missing it returns this explicit error with a link to the vmbackup docs on env-var credentials. It is a configuration validation error, not a network one.","triggerScenarios":"Exporting AZURE_STORAGE_ACCOUNT_KEY (or placing it in the environment of the vmbackup process) without exporting AZURE_STORAGE_ACCOUNT_NAME, then running a backup/restore with an azblob:// destination.","commonSituations":"CI/CD secrets configured only partially (key secret set, name forgotten), shell profile exporting the key but not the name, renaming env vars when migrating from another Azure tool that used different names.","solutions":["Export AZURE_STORAGE_ACCOUNT_NAME alongside AZURE_STORAGE_ACCOUNT_KEY","Verify with `env | grep AZURE_STORAGE` that both variables are visible to the vmbackup process","In CI, add the account name to the secret/env configuration of the job","Alternatively unset the key and use AZURE_USE_DEFAULT_CREDENTIAL with a managed identity or az login"],"exampleFix":"// before (shell/CI env)\nexport AZURE_STORAGE_ACCOUNT_KEY=xxxx\n// after\nexport AZURE_STORAGE_ACCOUNT_NAME=mystorageacct\nexport AZURE_STORAGE_ACCOUNT_KEY=xxxx","handlingStrategy":"validation","validationCode":"func requireAzureKeyPair() error {\n\tif os.Getenv(\"AZURE_STORAGE_ACCOUNT_KEY\") != \"\" && os.Getenv(\"AZURE_STORAGE_ACCOUNT_NAME\") == \"\" {\n\t\treturn fmt.Errorf(\"set AZURE_STORAGE_ACCOUNT_NAME when AZURE_STORAGE_ACCOUNT_KEY is provided\")\n\t}\n\treturn nil\n}\n// call before launching vmbackup\nif err := requireAzureKeyPair(); err != nil {\n\tlog.Fatal(err)\n}","typeGuard":null,"tryCatchPattern":"err := runBackup(ctx, cfg)\nif err != nil && strings.Contains(err.Error(), \"missing AZURE_STORAGE_ACCOUNT_NAME\") {\n\tlog.Fatalf(\"incomplete Azure env config: %v\", err)\n}","preventionTips":["Always define the account name and key as a paired secret in CI/CD systems","Add a startup env check (env | grep AZURE_STORAGE) to backup wrappers","Document required env vars next to backup cron/service definitions","Use one secret-set template so name and key are never configured independently"],"tags":["azure","environment-variables","configuration","credentials"],"backgroundTag":"missing-env-var","analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}