Search code examples
c#apiazureface

Face API "Access denied due to invalid subscription key..."


I have already tried with free trial keys associated with two different email addresses and a "Pay as you go" billing. They all returned this same message:

Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key.

I am using this FACE API getting started tutorial

private readonly IFaceServiceClient faceServiceClient = new FaceServiceClient("39a8b...0fd1");
var faces = await faceServiceClient.DetectAsync(imageFileStream);

Solution

  • I have an endpoint defined in the Portal "eastus2.api.cognitive.microsoft.com/face/v1.0"; but I don't know how to associated this endpoint with my service calls. What am I missing, please?

    If you got the endpoint, you could put it in the constructor of FaceServiceClient. Code below is for your reference.

    private readonly IFaceServiceClient faceServiceClient = 
        new FaceServiceClient("your_key", "https://eastus2.api.cognitive.microsoft.com/face/v1.0");
    

    enter image description here