Forum Discussion

gkakun's avatar
gkakun
Helper III
8 years ago

Power BI with Azure text analysis

Hi all,

 

I'm trying to use the keyphrase service in Azure, I used the API key from Azure and used anonymous credentials after I got few errors.

now, this is the error I'm getting, and have no idea how to solve this. 

I have tried all the options and get the same feedback

 

 

 

5 Replies

  • This is the code I am using 

     

    (text) => let
    apikey = "fd8e13fb24384e5fa9b2106fa5c7ab9d",
    endpoint = "https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/keyPhrases",
    jsontext = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody = "{ documents: [ { language: ""en"", id: ""0"", text: " & jsontext & " } ] }",
    bytesbody = Text.ToBinary(jsonbody),
    headers = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp = Json.Document(bytesresp),
    keyphrases = Text.Lower(Text.Combine(jsonresp[documents]{0}[keyPhrases], ", "))
    in keyphrases

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi gkakun

    As tested with your code in Query editor, I will see a query like this, but can't see any dataset imported.

     

    Also, when i click on the URL, it go to a page with error.

     

    Please check if your URL is wrong, and if your account for Power BI Desktop is the same with Azure text analysis'.

    Additionally, you could check this article to see if you have applied wrong steps.

     

    Best Regards

    Maggie

     

     

    • gkakun's avatar
      gkakun
      Helper III

      Hi Maggie, 

       

      I have dataset connected, I didnt mentioned it since I dont think it's the problem.

       

      About the URL, this is the URL I need to add since it's the one I have got from the Azure workspace.

       

      see attached  (end point)

       

       

      • gkakun's avatar
        gkakun
        Helper III

        And about the article, I just reviewed it, and looks like I did exactly the same. I can't see in the article any reference to the credentials. I think this is the problem I just couldn't find any way to solve this.  

    • gkakun's avatar
      gkakun
      Helper III

      Hi Maggie,

       

      I have managed to solve the problem in the query editor, and i can see the column I created from the functions. when i apply the changes I get this error- any idea why?