Access Azure Table Objects

So, I have this application that needs to query entities from Azure table storage from tables. I do not know the circuit.

1) Is there a way to do this with a Storageclient wrapper?
2) I suppose not, so I tried with the REST API, and I always get a 403 ban when I request entities.

This is my code.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("http://{0}.table.core.windows.net/Tables('{1}')", account,query));
request.UserAgent = " Microsoft ADO.NET Data Services";
request.KeepAlive = true;
request.Method = "GET";
request.Headers.Add("x-ms-version", "2009-09-19");
request.Headers.Add("x-ms-date", string.Format("{0} GMT", DateTime.UtcNow.ToString ("ddd, dd MMM yyyy HH:mm:ss")));
request.Headers.Add("Authorization", string.Format("SharedKey {0}:{1}", account, key));
request.Accept = "application/atom+xml,application/xml";
request.Headers.Add("Accept-Charset", "UTF-8");
request.Headers.Add("DataServiceVersion", "1.0;NetFx");
request.Headers.Add("MaxDataServiceVersion", "1.0;NetFx");

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+3
source share
3 answers

, Autorization .
, - , Autorization.
.

, @Jason ? . Azure, . .

0

Windows Azure tables can be requested through the OData protocol (odata.org). The easiest way is to have a PartitionKey and a RowKey object that wants to get / update / merge / delete.

All REST examples exist (for querying tables and entities): http://msdn.microsoft.com/en-us/library/dd179423.aspx

0
source

Source: https://habr.com/ru/post/1735041/


All Articles