Skip to content

404 Resource not found using Invoke-RestMethod #11

@Kikaider

Description

@Kikaider

When testing APIM using the provided example.ps1 run from a Window Server 2022 VM in the same subnet as APIM, I get a "404 Resource not found error".

Invoke-RestMethod : { "statusCode": 404, "message": "Resource not found" }
At line:39 char:1

  • Invoke-RestMethod -Uri $apimUrl -Method Post -Headers $apimHeaders -B ...
  •   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
    
    

AOAI is deployed with private endpoints to eastus in Azure Commercial.

APIM is deployed with private endpoints to eastus in Azure Commercial.

I get the same error whether APIM is deployed in a separate Resource groups or within the same Resource group as AOAI.

The APIM Managed identity has the [Cognitive Services User] and [Cognitive Services OpenAI User] roles on the AOAI Resource group.

The AOAI Vnet and the APIM Vnet are peered.

I added both the AOAI Vnet and the APIM Vnet to the AOAI Private DNS zone.

There is no data in App Insights. No Failed requests, but no Server requests either.

Using Invoke-Restmethod to access AOAI works from the AOAI vnet and from the APIM vnet. There are Windows VMs in each vnet for testing.

I confirmed the APIM backend URL matches the AOAI URL.

My resources when APIM installed in the AOAI Resource group:

Image

There is no NSG on the AOAI subnet.

The APIM NSG looks like this:

Image

I've build and rebuilt this solution several times and in 2 different subscriptions with the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions