getting `No HTTP resource was found that matches the request URI` on privateEndpointConnections API call

Harshavardhan 21 Reputation points

Below is the python code I use to get private endpoints for the key vaults I have in my Azure account.

vaults_url = "{}/resources?$filter=resourceType eq 'Microsoft.KeyVault/vaults'&api-version=2015-11-01".format(self.sub_id)  
vaults_resp = requests.get(vaults_url, headers=self.headers)  
vaults_resp = vaults_resp.json()  
if vaults_resp.get('error'):  
    raise Exception("{}, message: {}".format(vaults_resp.get('error', {}).get('code'),  
                                             str(vaults_resp.get('error', {}).get('message'))))  
for vault in vaults_resp.get('value', []):  
    rg = vault.get('id', '').split('/')[4]  
    print(self.sub_id, rg, vault.get('name'))  
    list_private_ep_url = AzureRestApiEndpoint.list_key_vaults_list_pvt_ep_conn_by_resource.format(self.sub_id, rg, vault.get('name'))  
    private_eps_url = requests.get(list_private_ep_url, headers=self.headers)  
    private_eps_url = private_eps_url.json()  
    if private_eps_url.get('error'):  
        raise Exception("{}, message: {}".format(private_eps_url.get('error', {}).get('code'),  
                                                 str(private_eps_url.get('error', {}).get('message'))))  

But upon running the script, I am getting the below error:

{'Message': "No HTTP resource was found that matches the request URI '{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.KeyVault/vaults/{vault-name}/privateEndpointConnections?api-version=2022-07-01'."}

The previous 2 API calls work fine with valid response.

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,184 questions
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,536 Reputation points Microsoft Employee

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer.

    When running your python script to get private endpoints for the key vaults, you ran into the below error message.

    Error Message:
    No HTTP resource was found that matches the request URI 'https://control-.../subscriptions/{subscription-id}/resourceGroups/{rg-name}/providers/Microsoft.KeyVault/vaults/{vault-name}/privateEndpointConnections?api-version=2022-07-01

    From your error message, you were able to resolve the issue by using the correct Key Vault Private Endpoint Connections - List By Resource API call.


    If you have any other questions or came to a different solution, please let me know and I can definitely update my answer.
    Thank you again for your time and patience throughout this issue.


    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Harshavardhan 21 Reputation points

    My apologies, the issue was on my end. I didn't construct the proper URL get-private-endpoints API call.

    0 comments No comments