{"id":80,"date":"2020-06-18T07:30:57","date_gmt":"2020-06-18T14:30:57","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azure-sdk\/?p=80"},"modified":"2020-09-11T14:38:52","modified_gmt":"2020-09-11T21:38:52","slug":"azure-sdk-release-june-2020","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azure-sdk\/azure-sdk-release-june-2020\/","title":{"rendered":"Azure SDK Release (June 2020) &#8211; Introducing the Azure SDK for Embedded Devices"},"content":{"rendered":"<p>Welcome to the June release of the Azure SDK. We have updated the following libraries:<\/p>\n<ul>\n<li>Cosmos DB (Java)<\/li>\n<li>Event Hubs<\/li>\n<li>Azure Storage<\/li>\n<li>Text Analytics<\/li>\n<\/ul>\n<p>These are ready to use in your production applications. You can find details of all released libraries on <a href=\"https:\/\/azure.github.io\/azure-sdk\/releases\/latest\/index.html\">our releases page<\/a>.<\/p>\n<p>New preview releases:<\/p>\n<ul>\n<li>Azure.Identity<\/li>\n<li>Azure Search<\/li>\n<li>Form Recognizer<\/li>\n<li>Service Bus<\/li>\n<\/ul>\n<p>In addition, we&#8217;ve released a new preview of the Azure SDK for Embedded C. See below for details.<\/p>\n<p>We believe these are ready for you to use and experiment with, but not yet ready for production. Between now and the GA release, these libraries may undergo API changes. We&#8217;d love your feedback! If you use these libraries and like what you see, or you want to see changes, let us know in GitHub issues.<\/p>\n<h2>Getting Started<\/h2>\n<p>Use the links below to get started with your language of choice. You will notice that all the preview libraries are tagged with &#8220;preview&#8221;.<\/p>\n<ul>\n<li><a href=\"https:\/\/azure.github.io\/azure-sdk\/releases\/2020-06\/dotnet.html\">.NET release notes<\/a><\/li>\n<li><a href=\"https:\/\/azure.github.io\/azure-sdk\/releases\/2020-06\/java.html\">Java release notes<\/a><\/li>\n<li><a href=\"https:\/\/azure.github.io\/azure-sdk\/releases\/2020-06\/python.html\">Python release notes<\/a><\/li>\n<li><a href=\"https:\/\/azure.github.io\/azure-sdk\/releases\/2020-06\/js.html\">JavaScript release notes<\/a><\/li>\n<\/ul>\n<p>If you want to dive deep into the content, the release notes linked above and the change logs they point to give more details on what has changed.<\/p>\n<h2>Introducing the Azure SDK for Embedded Devices<\/h2>\n<p>The <a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-c\">Azure Embedded C SDK<\/a> is designed to allow small embedded (IoT) devices to communicate with Azure services. Since we expect the client library code to run on microcontrollers that have slower CPUs and very limited amounts of flash, the Embedded C SDK is architected very differently than the Azure SDKs we offer in other languages.<\/p>\n<p>To properly address the needs of the embedded developer:<\/p>\n<ul>\n<li>The SDK is distributed as source code and compiled alongside your code.<\/li>\n<li>We target the <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg14\/\">C99 standard<\/a> and test with gcc, clang, and the Microsoft Visual C compilers.<\/li>\n<li>We offer very few abstractions, making the code easy to understand and debug.<\/li>\n<li>The SDK is non-allocating. Customers must allocate all data structures where they desire (for example, choosing between global memory, stack, heap, and so on) and then pass the address of the allocated structure into the functions that perform the various operations. This ensures out of memory errors are handled in user code.<\/li>\n<li>Unlike other languages, many common tasks (such as composing an <a href=\"https:\/\/channel9.msdn.com\/Shows\/On-NET\/Understanding-the-AzureCore-library\">HTTP pipeline of communication policies<\/a>) are done in source code as opposed to runtime. This reduces code size, improves execution speed, and locks in behavior, reducing the chance of bugs at runtime.<\/li>\n<li>We support microcontrollers with no operating system, microcontrollers with a real-time operating system (like <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/rtos\/\">Azure RTOS<\/a>), Linux, and Windows. You can implement your own &#8220;platform layer&#8221; to use the SDK on devices that are not supported &#8220;out-of-the-box&#8221;. The platform layer requires minimal functionality (such as a clock, sleep, atomic compare exchange, and an HTTP stack adapter). We provide some platform layers, and more will be added over time.<\/li>\n<\/ul>\n<h3>SDK architecture<\/h3>\n<p>At the heart of the SDK is what we refer to as <em>Azure Core<\/em>. This code defines several data types and functions for use by the client libraries such as the Azure IoT client libraries and the Azure Blob Storage client library. Some of the features you will use directly:<\/p>\n<ul>\n<li>A <strong>Span<\/strong> represents a byte buffer and is used for string manipulation, HTTP requests and responses, and for building and parsing JSON payloads. It allows us to return a substring within a larger string without any memory allocations.<\/li>\n<li>As the SDK performs operations, it can send log messages to an application-defined callback through the <strong>Logging<\/strong> feature. You can enable this to assist with debugging.<\/li>\n<li><strong>Context<\/strong>s offer an I\/O cancellation mechanism. Multiple contexts can be composed together in your application call tree. When a context is cancelled, its children are also cancelled.<\/li>\n<li>We provide a non-allocating <strong>JSON builder<\/strong> and <strong>JSON parser<\/strong>.<\/li>\n<li>We provide non-allocating <strong>HTTP request and response<\/strong> handlers.<\/li>\n<li>The SDK validates function arguments and invokes a callback when validation fails. By default, this callback suspends the calling thread <em>forever<\/em>. However, you can oevrride this behavior. Further, you can disable argument validation in production builds to obtain smaller and faster code.<\/li>\n<\/ul>\n<p>By utilizing Azure Core, Azure client libraries will share a common implementation and many features will behave identically across the suite of client libraries. For example, the standard HTTP pipeline unifies the handling of authentication, logging, retry, and telemetry.<\/p>\n<h3>Example: Uploading a blob to Azure Storage<\/h3>\n<p>The code below demonstrates how to upload ASCII text to an Azure Storage blob using the Azure Embedded C SDK. The sample also shows how to enable logging.<\/p>\n<pre><code>#include &lt;az_context.h&gt;\n#include &lt;az_storage_blobs.h&gt;\n#include &lt;curl\/curl.h&gt; \/\/ libcurl is our HTTP stack\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nstatic void log_func(az_log_classification classification, az_span message)\n{\n  (void)classification;\n  printf(\"%.*s\\n\", az_span_size(message), az_span_ptr(message));\n}\n\nint main()\n{\n  \/\/ Initialize libcurl\n  if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)\n  {\n    printf(\"Couldn't init libcurl\\n\");\n    return 1;\n  }\n  \/\/ Set up libcurl cleaning callback as to be called before ending program\n  atexit(curl_global_cleanup);\n\n  \/\/ Enable SDK logging:\n  az_log_classification const classifications[] = { \n      AZ_LOG_HTTP_RESPONSE, AZ_LOG_END_OF_LIST \n  };\n  az_log_set_classifications(classifications);\n  az_log_set_callback(log_func);\n\n  \/\/ Allocate &amp; initialize client using Blob URL (with SAS) from environment variable\n  az_storage_blobs_blob_client client;\n  if (az_storage_blobs_blob_client_init(\n          &amp;client, az_span_from_str(getenv(\"AZURE_STORAGE_URL\")), AZ_CREDENTIAL_ANONYMOUS, NULL)\n      != AZ_OK)\n  {\n    printf(\"Failed to initialize blob client\\n\");\n    return 1;\n  }\n\n  \/\/ Allocate a buffer to hold HTTP responses; reused by each HTTP request\n  uint8_t response_buffer[1024 * 4] = { 0 };\n\n  \/\/ Allocate &amp; initialize an HTTP response structure pasing it the HTTP response buffer\n  az_http_response http_response;\n  if (az_http_response_init(&amp;http_response, AZ_SPAN_FROM_BUFFER(response_buffer)) != AZ_OK)\n  {\n    printf(\"Failed to init http response\\n\");\n    return 1;\n  }\n\n  \/\/ Upload bytes to the blob\n  az_result blob_upload_result = az_storage_blobs_blob_upload(\n      &amp;client, &amp;az_context_app, AZ_SPAN_FROM_STR(\"Some content\"), NULL, &amp;http_response);\n  if (az_failed(blob_upload_result))\n  {\n    printf(\"Failed to upload blob\\n\");\n    return 1;\n  }\n\n  \/\/ Show HTTP response information\n  az_http_response_status_line status_line;\n  if (az_failed(az_http_response_get_status_line(&amp;http_response, &amp;status_line)))\n  {\n    printf(\"Failed to get status line\\n\");\n    return 1;\n  }\n\n  printf(\"HTTP Status Code: %d\\n\", status_line.status_code);\n  return 0;\n}\n<\/code><\/pre>\n<p>While this example demonstrates how to use <code>libcurl<\/code> as an HTTP stack, you can modify the code to use a different HTTP stack. See the <a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-c\">GitHub repository<\/a> for more information.<\/p>\n<h3>More information<\/h3>\n<p>For more information on using the Azure Embedded C SDK for IoT, check out the introductory video: <a href=\"https:\/\/channel9.msdn.com\/Shows\/Internet-of-Things-Show\/Introduction-to-the-new-Embedded-C-SDK-for-Azure-IoT\">Introduction to the new Embedded C SDK for Azure IoT<\/a>.<\/p>\n<h2>Working with us and giving feedback<\/h2>\n<p>So far, the community has filed hundreds of issues against these new SDKs with feedback ranging from documentation issues to API surface area change requests to pointing out failure cases. Please keep that coming. We work in the open on GitHub and you can submit issues here:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/Azure\/azure-sdk\/\">API design guidelines<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-net\">.NET<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-java\">Java<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-js\">JavaScript \/ TypeScript<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-python\">Python<\/a><\/li>\n<\/ul>\n<p>Finally, please keep up to date with all the news about the Azure developer experience programs and let us know how we are doing by following <a href=\"https:\/\/twitter.com\/AzureSDK\">@AzureSDK<\/a> on Twitter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This month, we introduce the Azure SDK for Embedded C, with a preview edition of the Storage client library.  In addition, we&#8217;ve updated the client libraries for Cosmos DB, Event Hubs, Storage, and Text Analytics.  We&#8217;ve also published new previews for Azure Identity, Cognitive Search, Form Recognizer, and Service Bus.<\/p>\n","protected":false},"author":39618,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[24],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-azure-sdk","tag-releases"],"acf":[],"blog_post_summary":"<p>This month, we introduce the Azure SDK for Embedded C, with a preview edition of the Storage client library.  In addition, we&#8217;ve updated the client libraries for Cosmos DB, Event Hubs, Storage, and Text Analytics.  We&#8217;ve also published new previews for Azure Identity, Cognitive Search, Form Recognizer, and Service Bus.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/users\/39618"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}