Logic Apps - List Secrets Azure Key Vault. How can I select the api version? I need secret Tags

Andoni Aguirre 45 Reputation points
2023-09-18T10:56:37.6766667+00:00

Hello,

I am creating a consumption Logic Apps that simply Lists Azure Key Vault secrets and then sends email if there are some about to expire within last 7 days:

User's image

Thing is that the List Secrets action from Logic Apps does not return the secret tags, whereas the rest api does (i.e. https://learn.microsoft.com/en-us/rest/api/keyvault/secrets/get-secrets/get-secrets?tabs=HTTP).

In the Logic Apps code editor I have tried modifying the "List Secrets" code in order to include api-version=7.4 but this does not work:

Request (input)

{
    "method": "get",
    "path": "/secrets?api-version=7.4",
    "host": {
        "connection": {
            "name": "/subscriptions/xxx-xxx-xxx/resourceGroups/rg-name/providers/Microsoft.Web/connections/keyvault"
        }
    }
}

Response:

{
    "statusCode": 404,
    "headers": {
        "Access-Control-Allow-Methods": "GET, PUT, PATCH, DELETE, POST",
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Max-Age": "3600",
        "Access-Control-Expose-Headers": "*",
        "Date": "Mon, 18 Sep 2023 10:43:24 GMT",
        "Content-Length": "54",
        "Content-Type": "application/json"
    },
    "body": {
        "statusCode": 404,
        "message": "Resource not found"
    }
}

How can I retrieve the tags with the List Secrets action? (preferably using Logic Apps built-in connectors, my Logic Apps is using system managed identity)

Thanks!

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,452 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,553 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2023-09-18T11:38:28.28+00:00

    @Anonymous Thanks for reaching out.

    It looks like you are using the List secrets action which returns the SecretMetadataCollection with value and continuationToken as documented and not the secret tags. You cannot specify the api-version=7.4 to this action and if you change anything in the code view then it will return 404 error as you have received as the path doesn't exist with the api-version.

    The workaround would be leveraging the HTTP action and call the respective HTTP API to get the requested details.

    Let me know if you have any queries or concerns.

    Please "Accept Answer" if the answer is helpful so that it can help others in the community.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.