How to fix (ResourceNotFound) PoliciesConfiguration not found while fetching product policy

Vinaayakh G 0 Reputation points
2024-08-13T03:44:57.9+00:00

Hi,

I am trying to download the current policy of a product that I have just created using the Python SDK. The code for the policy download is

def download_product_policy(api_management_client, resource_group_name, service_name, product_id):
    # This function should retrieve the existing policy for the Product
    response = api_management_client.product_policy.get(
            resource_group_name=resource_group_name,
            service_name=service_name,
            product_id=product_id,
            policy_id='policy'  # Assuming 'policy' is the correct policy_id
        )
    return response.value 

But I get the error (ResourceNotFound) PoliciesConfiguration not found.

The values for resource_group_name and service_name are correct because the Product was created using these values. product_id is the name of the created Product.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,105 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,025 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 26,866 Reputation points
    2024-08-15T17:38:45.29+00:00

    @Vinaayakh G Thanks for getting back, I don't see any issues with the code, could you please use the below rest api call to see if your able to fetch the product policy?
    https://learn.microsoft.com/en-us/rest/api/apimanagement/product-policy/list-by-product?view=rest-apimanagement-2022-08-01&tabs=HTTP#code-try-0


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.