I'm trying to get some info about my DB from MS Azure via REST API (it's only testing my knowledge about REST). Using C#. But where I need to put login and password for DB? or needn't ? I have 403 http error every time.
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. You would either need to provide a X509 based Management Certificate or use Azure AD token for authentication purposes. For more details on authenticating these API requests, please see this link: https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.