From 6ebe15304e37e3930987a4e8a913feba96d9d93c Mon Sep 17 00:00:00 2001 From: teowa <104055472+teowa@users.noreply.github.com> Date: Fri, 2 Dec 2022 17:21:57 +0800 Subject: [PATCH] two kv in different sub --- internal/services/keyvault/client/helpers.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/services/keyvault/client/helpers.go b/internal/services/keyvault/client/helpers.go index e2f0cd02533f..440be0065ea9 100644 --- a/internal/services/keyvault/client/helpers.go +++ b/internal/services/keyvault/client/helpers.go @@ -45,11 +45,12 @@ func (c *Client) BaseUriForKeyVault(ctx context.Context, keyVaultId parse.VaultI lock[cacheKey].Lock() defer lock[cacheKey].Unlock() + vaultsClient := c.VaultsClient if keyVaultId.SubscriptionId != c.VaultsClient.SubscriptionID { - c.VaultsClient = c.KeyVaultClientForSubscription(keyVaultId.SubscriptionId) + vaultsClient = c.KeyVaultClientForSubscription(keyVaultId.SubscriptionId) } - resp, err := c.VaultsClient.Get(ctx, keyVaultId.ResourceGroup, keyVaultId.Name) + resp, err := vaultsClient.Get(ctx, keyVaultId.ResourceGroup, keyVaultId.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { return nil, fmt.Errorf("%s was not found", keyVaultId)