public async Task<string> CreateWorkspace(string managementCertThumbprint, string azureSubscriptionId, string workspaceName, string location, string storageAccountName, string storageAccountKey, string ownerEmail, string source)
{
// initial workspace is a made-up but valid guid.
string reqUrl = string.Format(_azMgmtApiBaseUrl + "/e582920d010646acbb0ec3183dc2243a", azureSubscriptionId);
HttpWebRequest httpReq = GetRdfeHttpRequest(managementCertThumbprint, reqUrl, "PUT");
string payload = jss.Serialize(new
{
Name = workspaceName,
Region = location,
StorageAccountName = storageAccountName,
StorageAccountKey = storageAccountKey,
OwnerId = ownerEmail,
ImmediateActivation = true,
Source = source
});
httpReq.ContentLength = payload.Length;
Stream stream = httpReq.GetRequestStream();
byte[] buffer = Encoding.UTF8.GetBytes(payload);
stream.Write(buffer, 0, buffer.Length);
WebResponse resp = await httpReq.GetResponseAsync();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string result = sr.ReadToEnd();
dynamic d = jss.Deserialize<object>(result);
return d["Id"];
}