[英]How to store connection string in Azure Vault and map it back to the configuration settings in Azure Web App?
[英]The connection string is not updating on rotation for change feed in Azure
我正在使用 azure 更改提要將數據從一個數據庫遷移到另一個數據庫。 但是連接字符串每 24 小時輪換一次。 在我的代碼中,連接字符串鏈接到 azure 密鑰保管庫,該值在其中進行輪換。 每次輪換此密鑰並調用我的更改提要時,它仍然使用舊密鑰,因此會觀察到錯誤。
每次調用時,如何啟用更改提要從密鑰庫中讀取連接字符串?
由於秘密是一天前你可以使用
if (versions.First().CreatedOn.GetValueOrDefault() <= utcNow)
{
continue;
}
確保您正在使用OrderByDescendingAwait
和WhereAwait
來按時間倒序重新排列秘密並過濾掉。
foreach (var secret in secrets)
{
var versions = await client.GetPropertiesOfSecretVersionsAsync(secret.Name)
.WhereAwait(p => new ValueTask<bool>(p.Enabled.GetValueOrDefault() == true))
.OrderByDescendingAwait(p => new ValueTask<DateTimeOffset>(p.CreatedOn.GetValueOrDefault())).ToListAsync()
.ConfigureAwait(false);
有關更多信息,請參閱KeyVault Secrets 輪換管理。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.