Deepak Shaw
Deepak Shaw

Reputation: 667

Add & Delete a secret into Azure KeyVault using logic app standard

I'm using the logic app standard, I would like to keep the JWT token in Az KeyVault (as a secret). Read it until it expires. Once it expires I will regenerate and add a new version.

I'm using the code below for reading the key vault with managed identity.

    {
  "type": "Http",
  "inputs": {
    "uri": "https://xxxxx.vault.azure.net/secrets/DK-Test?api-version=7.3",
    "method": "GET",
    "authentication": {
      "type": "ManagedServiceIdentity",
      "audience": "https://vault.azure.net"
    }
  },
  "runAfter": {},
  "runtimeConfiguration": {
    "contentTransfer": {
      "transferMode": "Chunked"
    }
  }
}

enter image description here Can someone please help me to let me know How to add & delete a secret into Azure KeyVault using logic app standard? I didn't find a connector so far, Can we do this using an HTTP connector? Thanks for the reply, DK

Upvotes: 0

Views: 67

Answers (2)

DMabulage
DMabulage

Reputation: 896

Azure Key Vault Secret Updates using Logic App

https://samanax.com/2021/09/13/azure-key-vault-secret-updates-using-logic-app/

I tried it with a different approach. Using HTTP trigger and it worked

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 1

Deepak Shaw
Deepak Shaw

Reputation: 667

I found the solution after spending some time, here is the code:

Add:

{
  "type": "Http",
  "inputs": {
    "uri": "https://xxxxxx.vault.azure.net/secrets/DK-Test?api-version=7.3",
    "method": "PUT",
    "body": {
      "attributes": {
        "exp": 1788145100
      },
      "value": "abc-logic-app-test"
    },
    "authentication": {
      "type": "ManagedServiceIdentity",
      "audience": "https://vault.azure.net"
    }
  },
  "runAfter": {
    "NewToken": [
      "SUCCEEDED"
    ]
  },
  "runtimeConfiguration": {
    "contentTransfer": {
      "transferMode": "Chunked"
    }
  }
}

Delete:

{
  "type": "Http",
  "inputs": {
    "uri": "https://xxxxxxxxx.azure.net/secrets/Del-Me?api-version=7.3",
    "method": "DELETE",
    "authentication": {
      "type": "ManagedServiceIdentity",
      "audience": "https://vault.azure.net"
    }
  },
  "runAfter": {
    "AddNewToken-Ecase": [
      "SUCCEEDED"
    ]
  },
  "runtimeConfiguration": {
    "staticResult": {
      "name": "HTTP_10",
      "staticResultOptions": "Enabled"
    },
    "contentTransfer": {
      "transferMode": "Chunked"
    }
  }
}

Upvotes: 0

Related Questions