# Microsoft.Azure.WebJobs.Extensions.Storage：'AzureWebJobsStorage' 的值缺失或为空。请在运行函数前设置此应用设置。

- **ID:** `cloud/azure-function-app-storage-connection-string-invalid`
- **领域:** cloud
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

Azure Functions 运行时需要在 'AzureWebJobsStorage' 应用程序设置中提供有效的存储帐户连接字符串，以管理触发器、日志和状态。当该设置缺失、为空或指向无效存储帐户时会出现此错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Azure Functions runtime v4 | active | — | — |
| Azure Functions Core Tools 4.0.5801 | active | — | — |
| Azure CLI 2.56.0 | active | — | — |

## 解决方案

1. ```
   Add a valid storage account connection string to the function app's application settings using Azure CLI: 'az functionapp config appsettings set --name MyFunctionApp --resource-group MyResourceGroup --settings AzureWebJobsStorage="DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=mykey;EndpointSuffix=core.windows.net"'
   ```
2. ```
   Verify the storage account exists and is accessible by testing the connection string locally using Azure Storage Explorer or the 'az storage blob list' command.
   ```

## 无效尝试

- **** — Azure Functions requires a general-purpose v2 storage account (standard or premium). Using a premium block blob account without the correct endpoint format can cause the same error. (60% 失败率)
- **** — The setting is mandatory for the runtime to function. Without it, the function app cannot start. (100% 失败率)
