public override async Task <RegeneratedSecret> GetSecretToUseDuringRekeying() { _logger.LogInformation("Getting temporary secret to use during rekeying from other ({OtherKeyKind}) key...", GetOtherKeyKind(Configuration.KeyKind)); var searchService = await SearchService; IAdminKeys keys = await searchService.GetAdminKeysAsync(); _logger.LogInformation("Successfully retrieved temporary secret!"); return(new RegeneratedSecret() { Expiry = DateTimeOffset.UtcNow + TimeSpan.FromMinutes(10), UserHint = Configuration.UserHint, NewSecretValue = GetKeyValue(keys, GetOtherKeyKind(Configuration.KeyKind)) }); }
public override async Task <RegeneratedSecret> Rekey(TimeSpan requestedValidPeriod) { _logger.LogInformation("Regenerating Azure Search {KeyKind} admin key", Configuration.KeyKind); var searchService = await SearchService; await searchService.RegenerateAdminKeysAsync(GetKeyKind(Configuration.KeyKind)); IAdminKeys keys = await searchService.GetAdminKeysAsync(); _logger.LogInformation("Successfully rekeyed CosmosDB key kind {KeyKind}", Configuration.KeyKind); return(new RegeneratedSecret() { Expiry = DateTimeOffset.UtcNow + requestedValidPeriod, UserHint = Configuration.UserHint, NewSecretValue = GetKeyValue(keys, GetKeyKind(Configuration.KeyKind)) }); }