---
title: Azure Cloud Services
pagination_prev: demos/local/index
pagination_next: demos/extensions/index
---
import current from '/version.js';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
[Azure Cloud Services](https://azure.microsoft.com/) is a cloud services
platform which includes traditional virtual machine support, "Serverless
Functions" and cloud storage.
[SheetJS](https://sheetjs.com) is a JavaScript library for reading and writing
data from spreadsheets.
This demo explores two key AWS offerings:
- ["Azure Functions"](#azure-functions) ("Lambda") explores the serverless
  computing offering. The demo creates a JavaScript function that can process
  user-submitted files and generate spreadsheets.
- ["Blob Storage"](#blob-storage) explores the cloud storage offering. The demo
  uses the NodeJS connection library to read spreadsheets from storage and write
  spreadsheets back to cloud storage.
:::caution pass
Azure iterates quickly and there is no guarantee that the referenced services
will be available in the future.
:::
:::note Tested Deployments
This demo was last tested on 2023 October 06.
:::
## Telemetry
:::warning Telemetry
**Each command-line tool related to Azure embeds telemetry.**
Azure tools embed telemetry without proper disclaimer.
:::
It is strongly recommended to disable telemetry before working with Azure.
#### Azure Functions Core Tools
Azure Functions Core Tools (`func`) telemetry is controlled through the
`FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT` environment variable.
  
Add the following line to `.profile`, `.bashrc` and `.zshrc`:
```bash
export FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT=1
```
Close and restart the Terminal to load the changes.
  
  
Type `env` in the search bar and select "Edit the system environment variables".
In the new window, click the "Environment Variables..." button.
In the new window, look for the "System variables" section and click "New..."
Set the "Variable name" to `FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT` and the value
to `1`.
Click "OK" in each window (3 windows) and restart your computer.
  
#### Azure CLI
Azure CLI (`az`) telemetry can be disabled using a subcommand (after installing
the CLI tool)[^1]:
```bash
az configure -d collect_telemetry=false
```
## Azure Functions
The [SheetJS NodeJS module](/docs/getting-started/installation/nodejs) can be
required in Azure Functions that use the NodeJS runtime.
This discussion focuses on the "HTTP Trigger" function type.
:::note pass
In earlier tests, to enable binary data processing, `function.json` required a
`dataType` option:
```json title="function.json"
{
  "bindings": [
    {
      "type": "httpTrigger",
      "direction": "in",
//highlight-next-line
      "dataType": "binary",
      "name": "req",
```
In the most recent test, the template did not create a `function.json` and the
option was not required.
:::
### Reading Data
Using `@azure/functions`, the handler callback receives a `Request` object.
Uploaded files can be pulled into `ArrayBuffer` objects.
Code Snippet (click to show)
This function returns a promise that resolves to an `ArrayBuffer` object:
```js
const { Blob } = require('buffer');
async function get_file_from_request(request, form_field_name) {
  /* parse the request body */
  const formData = await request.formData();
  /* pull the specified field */
  const file = formData.get(form_field_name);
  /* if a file was submitted, `file` will be a Blob */
  if(!(file instanceof Blob)) throw new Error(`File is missing!`);
  /* pull data into an ArrayBuffer object */
  const ab = await file.arrayBuffer();
  return ab;
}
```