简体   繁体   English

Azure SQL Server Rest API访问

[英]Azure SQL Server Rest API access

I'm trying to get some info about my DB from MS Azure via REST API (it's only testing my knowledge about REST). 我正在尝试通过REST API从MS Azure获取有关我的数据库的一些信息(这只是测试我对REST的了解)。 Using C#. 使用C#。 But where I need to put login and password for DB? 但是我需要在哪里输入数据库的登录名和密码? or needn't ? 还是不需要? I have 403 http error every time. 我每次都遇到403 http错误。

WebRequest request = WebRequest.Create("https://management.core.windows.net:8443/{subscriptionId}/services/sqlservers/servers/{servername}/databases/testDB");
       request.Method = "GET";
       request.Headers.Add("x-ms-version", "2012-03-01");
       WebResponse response = request.GetResponse();
       Stream stream = response.GetResponseStream();
       StreamReader reader = new StreamReader(stream, Encoding.UTF8);
       String res = reader.ReadToEnd();
       Console.WriteLine(res);

The REST API operations you're trying to perform are part of Azure Service Management API and they work on a different authentication mechanism. 您尝试执行的REST API操作是Azure Service Management API一部分,它们在不同的身份验证机制上运行。 You would either need to provide a X509 based Management Certificate or use Azure AD token for authentication purposes. 您可能需要提供基于X509的管理证书,或者将Azure AD令牌用于身份验证。 For more details on authenticating these API requests, please see this link: https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx . 有关验证这些API请求的更多详细信息,请参见以下链接: https : //msdn.microsoft.com/zh-cn/library/azure/ee460782.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM