Azure / Azure/azure-functions-host
Add retry logic when reading secrets from Blob Storage
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
Currently, we only try once when reading secrets from Blob Storage. Perhaps it would make sense to add retry logic for certain scenarios like a transient unavailable storage account issue.
Here is the link to the code that reads from Blob Storage:
https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Security/KeyManagement/BlobStorageSecretsRepository.cs#L93
```
public override async Task ReadAsync(ScriptSecretsType type, string functionName)
{
string secretsContent = null;
string blobPath = GetSecretsBlobPath(type, functionName);
try
{
CloudBlockBlob secretBlob = Container.GetBlockBlobReference(blobPath);
if (await secretBlob.ExistsAsync())
{
secretsContent = await secretBlob.DownloadTextAsync();
}
}
catch (Exception e)
{
LogErrorMessage("read");
throw e;
}
return string.IsNullOrEmpty(secretsContent) ? null : ScriptSecretSerializer.DeserializeSecrets(type, secretsContent);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.