Copy secrets from Keyvault1 (subscription A) to Keyvault2 (subscription B ) using logic app

Rajesh Ambakkat 216 Reputation points
2022-05-17T16:44:25.753+00:00

I have a scenario, in which when user changes secrets in keyvault 1 (subscription A), i would like to copy the same secrets to keyvault2( in another subscription B). Is this possible? If yes can i use a logic app to copy the secrets from keyvault 1 (subscription A) --> keyvault2( subscription B).

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,138 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,873 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,986 Reputation points
    2022-05-30T07:46:56.76+00:00

    @Rajesh Ambakkat Thanks for reaching out. Apology for the delay in reaching out. Yes, you can automate your requirement using logic app workflow.
    As you can monitor the keyvault resource using the event grid as documented here. The available events for Microsoft.KeyVault are listed here. So as per your requirement as someone updated the secret so the Microsoft.KeyVault.SecretNewVersionCreated event will be fired and call the logic app for further processing. You can call any HTTP call from logic app leveraging the Native HTTP connector.

    **Workflow: **
    Event Grid Trigger (when a resource event occurs) --> Native HTTP Connector (calls the Get Secret API to get the Secret) --> Native HTTP Connector (set Secret to create the same Secret as per the get secret API response from previous action)

    In case you want to get familiar with Azure REST API and how you can authenticate the request you can refer to this REST document.

    0 comments No comments