{"record":{"id":"1ea86a4f15a10494","repo":"gofr-dev/gofr","slug":"invalid-azure-configuration-account-key-is-requir","errorCode":null,"errorMessage":"invalid Azure configuration: account key is required","messagePattern":"invalid Azure configuration: account key is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gofr/datasource/file/azure/fs.go","lineNumber":14,"sourceCode":"package azure\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"time\"\n\n\t\"gofr.dev/pkg/gofr/datasource/file\"\n)\n\nvar (\n\terrInvalidConfig       = errors.New(\"invalid Azure configuration: share name is required\")\n\terrAccountNameRequired = errors.New(\"invalid Azure configuration: account name is required\")\n\terrAccountKeyRequired  = errors.New(\"invalid Azure configuration: account key is required\")\n)\n\nconst defaultTimeout = 10 * time.Second\n\ntype azureFileSystem struct {\n\t*file.CommonFileSystem\n}\n\n// Config represents the Azure File Storage configuration.\ntype Config struct {\n\tAccountName string // Azure Storage Account name\n\tAccountKey  string // Azure Storage Account key\n\tShareName   string // Azure File Share name\n\tEndpoint    string // Azure Storage endpoint (optional, defaults to core.windows.net)\n}\n\n// New creates and validates a new Azure File Storage file system.\n// Returns error if configuration is invalid.","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/gofr-dev/gofr/blob/187eb24962502e91f1fee856230670958b66e89c/pkg/gofr/datasource/file/azure/fs.go#L1-L32","documentation":"azure.New validation also requires Config.AccountKey; if it is empty the constructor returns errAccountKeyRequired — \"invalid Azure configuration: account key is required\". The account key (shared-key credential) is what authenticates every request to Azure Files, so without it the SDK client cannot be built and the library fails fast at construction time.","triggerScenarios":"Calling azure.New with a Config whose AccountKey == \"\": the secret not mounted/injected, an empty env var, or a config built with ShareName and AccountName but no key.","commonSituations":"Kubernetes secret not created or misnamed in the manifest; CI pipeline lacking secret injection; rotating keys in Azure portal and clearing the old value locally; local development .env missing the key entry.","solutions":["Set Config.AccountKey from the storage account's shared key (Azure Portal > Storage account > Access keys).","Verify the secret mount / env injection in the deployment actually populates the value (check for empty string, not just presence).","Consider Managed Identity or SAS tokens instead of account keys to avoid secret-management pitfalls.","Confirm key rotation didn't leave the app with a blank or revoked key."],"exampleFix":"// before\ncfg := &Config{ShareName: \"files\", AccountName: acc} // AccountKey missing\nfs := azure.New(cfg)\n// after\nkey := os.Getenv(\"AZURE_ACCOUNT_KEY\")\nif key == \"\" { log.Fatal(\"AZURE_ACCOUNT_KEY is required\") }\ncfg := &Config{ShareName: \"files\", AccountName: acc, AccountKey: key}\nfs := azure.New(cfg)","handlingStrategy":"validation","validationCode":"if cfg.AccountKey == \"\" {\n    return errors.New(\"AZURE_ACCOUNT_KEY is required for azure files\")\n}","typeGuard":"func hasAccountKey(cfg *azure.Config) bool {\n    return cfg != nil && strings.TrimSpace(cfg.AccountKey) != \"\"\n}","tryCatchPattern":null,"preventionTips":["Verify secret mounts actually populate the env var (log length, never the value).","Prefer Managed Identity or SAS tokens to reduce key-management failures.","Track key rotation and update deployed secrets atomically."],"tags":["azure","configuration","credentials","azure-files"],"backgroundTag":"missing-credentials","analyzedSha":"187eb24962502e91f1fee856230670958b66e89c","analyzedAt":"2026-09-01T20:34:54.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}