2016-10-24 1 views
0

私は私の組織のAzureデータカタログを使用しています。私はカタログの作成者/管理者/所有者ではありませんが、Webインターフェイスからカタログを登録/削除するアクセス権があります。安息日Azureデータカタログ

私はAzureデータカタログのためにrest APIを使用したいと思います。私の許可のレベルで可能ですか? 私はhttps://msdn.microsoft.com/en-us/library/mt428033.aspxからすべての手順に従い、以下のコードを書かれている:私は今

System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at HRBIADCAPI.Program.Main(String[] args) in c:\users\naghimir\documents\visual studio 2015\Projects\HRBIADCAPI\HRBIADCAPI\Program.cs:line 32

class Program 
{ 
    static void Main(string[] args) 
    { 
     string url = "https://api.azuredatacatalog.com/catalogs/DefaultCatalog/search/search?searchTerms=My_Server&count=10&startPage=1&api-version=2016-03-30"; 

     HttpWebRequest request = System.Net.WebRequest.Create(url) as System.Net.HttpWebRequest; 


     Console.WriteLine(AccessToken().CreateAuthorizationHeader()); 


     try 
     { 
      WebResponse response = request.GetResponse(); 
      Console.WriteLine(response.ContentLength); 
     } 
     catch (Exception e) 
     { 
      Console.WriteLine(e); 
     } 

     Console.ReadKey(); 
    } 

    static AuthenticationResult AccessToken() 
    { 
     string resourceUri = "https://datacatalog.azure.com"; 

     string clientId = "my-client-id"; 

     string redirectUri = "my-redirect-uri"; 

     string authorityUri = "https://login.windows.net/common/oauth2/authorize"; 
     AuthenticationContext authContext = new AuthenticationContext(authorityUri); 

     return authContext.AcquireToken(resourceUri, clientId, new Uri(redirectUri), PromptBehavior.RefreshSession); 

    } 
} 

と私はAPIから検索を実行しようとすると、私は次のエラーを取得します私がAzure Data Factoryで行ったデータカタログを読み書きするために作成されたクライアントプログラムにアクセスする権限を与えていないのが問題だと思いますが、そのステップはドキュメントにもありません。

Azure Data Catalog APIを使用するには所有者である必要がありますか、所有者の許可を得ることができますか?

答えて

1

説明に基づいて、OAuth 2.0コード許可フローを使用して、Azureデータカタログを操作するユーザーを委任するようにアプリを許可していました。

要求がうまく動作することを確認するために、我々は下図のようなアプリにスコープを付与する必要があります。 enter image description here

そして、アプリはユーザーのみの許可を委任以来、そのユーザーを確認してくださいへの十分な権限を持っていますリソースを手動で操作してください。

関連する問題