Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

TFS anonymous access

Hi,

 

I'm blocked and I need your help. I would like to do on PowerBI a POST API request on a TFS server which works fine on Postman but I always the same issue on PBI:

DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.
Details:
DataSourceKind=Web
DataSourcePath=http://{instance}/DefaultCollection/{project}/_apis/wit/

 

The request is:

 

let
    url = "http://{instance}/DefaultCollection/{project}/_apis/wit/wiql?api-version=3.0",
    content = "
    {""query"": ""
        SELECT *
        FROM WorkItemLinks 
    	WHERE 
		    ([System.Links.LinkType] = 'System.LinkTypes.Dependency-Forward') 
		    AND Source.[System.WorkItemType] = 'Requirement' 
		    AND Source.[System.State] <> 'Closed'
			
		    AND ( Target.[System.WorkItemType] = 'Task' 
				OR Target.[System.WorkItemType] = 'Bug')
		    AND Target.[System.State] <> 'Closed'
	    ORDER BY [System.Id] 
	    ASOF '1/1/15'    
        mode(maycontain)""
    }",
    Source = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(content) ] ))
in
    Source

As said below, on Postman, it works fine using NTLM Authentication method. So I do not known if the issue coming from the authentication method used on powerbi (basic GET API rest method works) or if the method is not correctly written ...

 

3 Replies

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

    Hi Anonymous ,

     For the error message, I think you didn't choose Anonymous authentication for the web data source.

     

    Please open Data Source Settings, then find the web data source, choose Anonymous like below: 

     

    q2.PNG

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you v-xuding-msft 

      I already tried this solution, but it doesn't work:

       

       

       

       

       

       

       

      I also tried a POST request which doesn't need authentication, and every thing is ok, I suppose that I need to include authentication parameters into my request. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        After several investigations I found the issue but I didn't find the solution yet ...

        Using basic authentication, when I run the query I have following issue :

         

        "Expression.Error: The 'Authorization' header is only supported when connecting anonymously. These headers can be used with all authentication types: Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, Content-Type, If-Modified-Since, Prefer, Referer"

         

        So, I changed the connection setting but, when I try to connect with Anonymous access to TFS I have following issue:

         

         

         

         

         

         

         

         

         

         

         

        I tried with the TFS2017 OnPrem version of my compagny, with my personal ADOS, still the same issue, I couldn't connect to TFS anonymously ...  Any idea ?