System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found) + API Management DevOps Resource Kit

Taranjeet Malik 546 Reputation points
2024-04-11T03:20:13.1333333+00:00

Hi Community

I'm using the API Management DevOps Resource Kit (https://github.com/Azure/azure-api-management-devops-resource-kit) to extract the ARM Templates from a tenant. The toolkit worked well (and still working) with at least 5 API instances, but is failing to extract one particular API instance. Here's the error I'm seeing:

Started generation of ApiManagement service template...

[12:46:20 ERR] Error occured: Response status code does not indicate success: 404 (Not Found).

System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).

at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()

at Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.API.Clients.Abstractions.ApiClientBase.CallApiManagementAsync(String azToken, String requestUrl, Boolean useCache, ClientHttpMethod method) in C:\Users\abc\Source\Repos\azure-api-management-devops-resource-kit\src\ArmTemplates\Common\API\Clients\Abstractions\ApiClientBase.cs:line 52

at Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.API.Clients.Abstractions.ApiClientBase.GetResponseAsyncTResponse in C:\Users\abc\Source\Repos\azure-api-management-devops-resource-kit\src\ArmTemplates\Common\API\Clients\Abstractions\ApiClientBase.cs:line 65

at Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.API.Clients.ApiManagementService.ApiManagementServiceClient.GetApiManagementServiceAsync(ExtractorParameters extractorParameters) in C:\Users\abc\Source\Repos\azure-api-management-devops-resource-kit\src\ArmTemplates\Common\API\Clients\ApiManagementService\ApiManagementServiceClient.cs:line 36

at Microsoft.Azure.Management.ApiManagement.ArmTemplates.Extractor.EntityExtractors.ApiManagementServiceExtractor.GenerateApiManagementServicesTemplateAsync(ExtractorParameters extractorParameters) in C:\Users\abc\Source\Repos\azure-api-management-devops-resource-kit\src\ArmTemplates\Extractor\EntityExtractors\ApiManagementServiceExtractor.cs:line 38

Any pointers to troubleshoot the issue will be greatly appreciated.

Thanks

Taranjeet Singh

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,122 questions
0 comments No comments
{count} votes

Accepted answer
  1. hossein jalilian 7,055 Reputation points
    2024-04-11T05:12:22.3+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    This could happen due to a few reasons:

    1. Ensure the account used for extraction has necessary permissions, like the "Reader" role on the API Management service.
    2. Check for network issues or firewall rules that could hinder access to the API Management service.
    3. Verify the API Management service is healthy and not undergoing changes like updates or deletion.
    4. Confirm the provided resource ID or name matches the intended service for extraction.

    Some troubleshooting steps you can try:

    1. Ensure the service principal or user account has the "Reader" role on the API Management service resource.
    2. Consider using a different authentication method if encountering issues.
    3. Network Connectivity: Test the extractor from a different network or machine to troubleshoot connectivity problems.
    4. Verify the API Management service status to ensure it's not undergoing updates or deletion.
    5. Double-check the provided resource ID or name against the actual service in Azure portal or CLI.

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


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.