Skip to content

Commit

Permalink
Update Node.js & browser support in README (#16011)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a authored Jun 25, 2021
1 parent 82085ff commit b729674
Show file tree
Hide file tree
Showing 73 changed files with 336 additions and 174 deletions.
3 changes: 1 addition & 2 deletions common/tools/dev-tool/src/templates/sampleReadme.md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import YAML from "yaml";

import prettier from "prettier";

import { MIN_SUPPORTED_NODE_VERSION } from "../util/sampleConfiguration";
import { SampleReadmeConfiguration } from "../util/sampleGenerationInfo";

/**
Expand Down Expand Up @@ -166,7 +165,7 @@ ${table(info)}
## Prerequisites
The sample programs are compatible with Node.js >=${MIN_SUPPORTED_NODE_VERSION}.
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
${(() => {
if (info.useTypeScript) {
Expand Down
2 changes: 1 addition & 1 deletion samples/cors/ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This sample demonstrates a few alternatives to integrating with Azure Key Vault

## Prerequisites

The sample is compatible with Node.js >= 8.0.0
The sample is compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/)

Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript].

Expand Down
2 changes: 1 addition & 1 deletion samples/frameworks/electron/ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this sample, we build a simple [Electron][electron] application and integrati

## Prerequisites

The samples are compatible with Node.js >= 8.0.0.
The samples are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/)

Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript].

Expand Down
2 changes: 1 addition & 1 deletion samples/frameworks/react/ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this sample, we build a simple Todo application in React using [create-react-

## Prerequisites

The samples are compatible with Node.js >= 8.0.0.
The samples are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).

Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript].

Expand Down
4 changes: 2 additions & 2 deletions samples/web-workers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ In this sample we demonstrate how to polyfill the necessary APIs for using our l

### XML Parsing

When used in the browser, our XML parsing library relies on DOM APIs to support parsing and stringifying XML. Since the DOM APIs are generally available this reduces bundle size and minimizes our dependencies. When running from a Web Worker, however, DOM APIs are not available. This is a browser limitation and requires a polyfill before importing our client libraries in web workers.
When used in the browser, our XML parsing library relies on DOM APIs to support parsing and stringifying XML. Since the DOM APIs are generally available this reduces bundle size and minimizes our dependencies. When running from a Web Worker, however, DOM APIs are not available. This is a browser limitation and requires a polyfill before importing our client libraries in web workers.

> Note: Not all client libraries use XML. When running in a web worker, our library will emit a useful error explaining what APIs are required if they are missing so that you can add them as needed.
In these samples we use [JSDOM][jsdom] but you can use any library that provides a DOM implementation.

## Prerequisites

The samples are compatible with Node.js >= 8.0.0.
The samples are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).

Before running the TypeScript samples, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript].

Expand Down
9 changes: 6 additions & 3 deletions sdk/anomalydetector/ai-anomaly-detector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Key links:

- [Source code](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/anomalydetector/ai-anomaly-detector/)
- [Package (NPM)](https://www.npmjs.com/package/@azure/ai-anomaly-detector)
- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/ai-anomaly-detector)
- [Product documentation](https://docs.microsoft.com/azure/cognitive-services/anomaly-detector/)
- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/ai-anomaly-detector)
- [Product documentation](https://docs.microsoft.com/azure/cognitive-services/anomaly-detector/)
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/anomalydetector/ai-anomaly-detector/samples)

## Key concepts
Expand All @@ -22,7 +22,10 @@ The `AnomalyDetectorClient` provides methods for anomaly detection:

### Currently supported environments

- Node.js version 8.x.x or higher
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.

See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.

### Prerequisites

Expand Down
11 changes: 9 additions & 2 deletions sdk/appconfiguration/app-configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ Key links:
npm install @azure/app-configuration
```

### Currently supported environments

- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.

See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.

### Prerequisites

- You must have an [Azure Subscription](https://azure.microsoft.com) and an [App Configuration](https://docs.microsoft.com/azure/azure-app-configuration/) resource to use this package.
- Node.js version 8.x.x or higher
- An [Azure Subscription](https://azure.microsoft.com)
- An [App Configuration](https://docs.microsoft.com/azure/azure-app-configuration/) resource

### Create an App Configuration resource

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This sample application shows how to use the Feature Flags.

## Prerequisites

The samples are compatible with Node.js >= 8.0.0.
The samples are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).

You need [an Azure subscription][freesub] and the following resources created to run this sample:

Expand Down
123 changes: 62 additions & 61 deletions sdk/attestation/attestation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@ For a more complete view of Azure libraries, see the [azure sdk typescript relea
Key links:

- [Source code][source_code]
- [Package (NPM)][Attestation_npm]
- [API reference documentation][API_reference]
- [Source code][source_code]
- [Package (NPM)][attestation_npm]
- [API reference documentation][api_reference]
- [Product documentation](https://docs.microsoft.com/azure/attestation/)

## Getting started

### Currently supported environments

- Node.js version 8.x.x or higher
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.

See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.

### Prerequisites

- An Azure subscription. To use Azure services, including the Microsoft Azure Attestation service, you'll need a subscription. If you do not have an existing Azure account, you may sign up for a [free trial][azure_sub] or use your [Visual Studio Subscription](https://visualstudio.microsoft.com/subscriptions/) benefits when you [create an account](https://account.windowsazure.com/Home/Index).
- An [Azure Subscription](https://azure.microsoft.com)
- An existing Azure Attestation Instance, or you can use the "shared provider" available in each Azure region. If you need to create an Azure Attestation service instance, you can use the Azure Portal or [Azure CLI][azure_cli].

### Install the @azure/attestation package

Install the Microsoft Azure Attestation client library for JavaScript with [NPM][Attestation_npm]:
Install the Microsoft Azure Attestation client library for JavaScript with [NPM][attestation_npm]:

```Powershell
npm install @azure/attestation
Expand All @@ -41,9 +44,9 @@ npm install @azure/attestation
### Authenticate the client

In order to interact with the Microsoft Azure Attestation service, you'll need to create an instance of the [Attestation Client][attestation_client] or [Attestation Administration Client][attestation_admin_client] class. You need a **attestation instance url**, which you may see as "DNS Name" in the portal,
and **client secret credentials (client id, client secret, tenant id)** to instantiate a client object.
and **client secret credentials (client id, client secret, tenant id)** to instantiate a client object.

Client secret credential authentication is being used in this getting started section but you can find more ways to authenticate with [Azure identity][azure_identity]. To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below,
Client secret credential authentication is being used in this getting started section but you can find more ways to authenticate with [Azure identity][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below,
or other credential providers provided with the Azure SDK, you should install the Azure.Identity package:

```Powershell
Expand All @@ -56,35 +59,35 @@ Use the [Azure CLI][azure_cli] snippet below to create/get client secret credent

- Create a service principal and configure its access to Azure resources:

```Powershell
az ad sp create-for-rbac -n <your-application-name> --skip-assignment
```
```Powershell
az ad sp create-for-rbac -n <your-application-name> --skip-assignment
```

Output:
Output:

```json
{
"appId": "generated-app-ID",
"displayName": "dummy-app-name",
"name": "http://dummy-app-name",
"password": "random-password",
"tenant": "tenant-ID"
}
```
```json
{
"appId": "generated-app-ID",
"displayName": "dummy-app-name",
"name": "http://dummy-app-name",
"password": "random-password",
"tenant": "tenant-ID"
}
```

- Take note of the service principal objectId

```Powershell
az ad sp show --id <appId> --query objectId
```
```Powershell
az ad sp show --id <appId> --query objectId
```

Output:
Output:

```Powershell
"<your-service-principal-object-id>"
```
```Powershell
"<your-service-principal-object-id>"
```

- Use the returned credentials above to set **AZURE_CLIENT_ID** (appId), **AZURE_CLIENT_SECRET** (password), and **AZURE_TENANT_ID** (tenant) environment variables. The following example shows a way to do this in Powershell:
- Use the returned credentials above to set **AZURE_CLIENT_ID** (appId), **AZURE_CLIENT_SECRET** (password), and **AZURE_TENANT_ID** (tenant) environment variables. The following example shows a way to do this in Powershell:

```Powershell
$Env:AZURE_CLIENT_ID="generated-app-ID"
Expand All @@ -99,7 +102,7 @@ For more information about the Azure Identity APIs and how to use them, see [Azu
There are four major families of functionality provided in this preview SDK:

- [SGX and TPM enclave attestation.](#attestation)
- [MAA Attestation Token signing certificate discovery and validation.](#attestation-token-signing-certificate-discovery-and-validation)
- [MAA Attestation Token signing certificate discovery and validation.](#attestation-token-signing-certificate-discovery-and-validation)
- [Attestation Policy management.](#policy-management)
- [Attestation policy management certificate management](#policy-management-certificate-management) (yes, policy management management).

Expand Down Expand Up @@ -143,9 +146,9 @@ clients to "roll" the policy management certificates.

### Isolated Mode and AAD Mode

Each Microsoft Azure Attestation service instance operates in either "AAD" mode or "Isolated" mode. When an MAA instance is operating in AAD mode, it means that the customer which created the attestation instance allows Azure Active Directory and Azure Role Based Access control policies to verify access to the attestation instance.
Each Microsoft Azure Attestation service instance operates in either "AAD" mode or "Isolated" mode. When an MAA instance is operating in AAD mode, it means that the customer which created the attestation instance allows Azure Active Directory and Azure Role Based Access control policies to verify access to the attestation instance.

### *AttestationType*
### _AttestationType_

The Microsoft Azure Attestation service supports attesting different types of evidence depending on the environment.
Currently, MAA supports the following Trusted Execution environments:
Expand Down Expand Up @@ -186,13 +189,13 @@ The `getPolicy` method retrieves the attestation policy from the service.
Attestation Policies are instanced on a per-attestation type basis, the `AttestationType` parameter defines the type to retrieve.

```js
const policyResult = await adminClient.getPolicy(attestationType);
const policyResult = await adminClient.getPolicy(attestationType);

// The text policy document is available in the `policyResult.value`
// property.
// The text policy document is available in the `policyResult.value`
// property.

// The actual attestation token returned by the MAA service is available
// in `policyResult.token`.
// The actual attestation token returned by the MAA service is available
// in `policyResult.token`.
```

### Set an attestation policy for a specified attestation type
Expand Down Expand Up @@ -222,20 +225,19 @@ There are two properties provided in the [PolicyResult][attestation_policy_resul
To verify the hash, clients can generate an attestation token and verify the hash generated from that token:

```js
const expectedPolicy = AttestationToken.create(
{
body: new StoredAttestationPolicy(minimalPolicy).serialize(),
signer: signer
});

// Use your favorite SHA256 hash generator function to create a hash of the
// stringized JWS. The tests in this package use `KJUR.crypto.Util.hashString(buffer, "sha256")`
// from the `jsrsasign` library, but any crypto library will
// work.
const expectedHash = generateSha256Hash(expectedPolicy.serialize());

// The hash returned in expectedHash will match the value in
// `setResult.value.policy_token_hash.
const expectedPolicy = AttestationToken.create({
body: new StoredAttestationPolicy(minimalPolicy).serialize(),
signer: signer
});

// Use your favorite SHA256 hash generator function to create a hash of the
// stringized JWS. The tests in this package use `KJUR.crypto.Util.hashString(buffer, "sha256")`
// from the `jsrsasign` library, but any crypto library will
// work.
const expectedHash = generateSha256Hash(expectedPolicy.serialize());

// The hash returned in expectedHash will match the value in
// `setResult.value.policy_token_hash.
```

### Attest SGX Enclave
Expand All @@ -248,7 +250,7 @@ One solution to this problem is what is known as "Secure Key Release", which is

To implement the "Secure Key Release" pattern, the enclave code generates an ephemeral asymmetric key. It then serializes the public portion of the key to some format (possibly a JSON Web Key, or PEM, or some other serialization format).

The enclave code then calculates the SHA256 value of the public key and passes it as an input to code which generates an SGX Quote (for OpenEnclave, that would be the [oe_get_evidence](https://openenclave.io/apidocs/v0.14/attester_8h_a7d197e42468636e95a6ab97b8e74c451.html#a7d197e42468636e95a6ab97b8e74c451) or [oe_get_report](https://openenclave.io/apidocs/v0.14/enclave_8h_aefcb89c91a9078d595e255bd7901ac71.html#aefcb89c91a9078d595e255bd7901ac71)).
The enclave code then calculates the SHA256 value of the public key and passes it as an input to code which generates an SGX Quote (for OpenEnclave, that would be the [oe_get_evidence](https://openenclave.io/apidocs/v0.14/attester_8h_a7d197e42468636e95a6ab97b8e74c451.html#a7d197e42468636e95a6ab97b8e74c451) or [oe_get_report](https://openenclave.io/apidocs/v0.14/enclave_8h_aefcb89c91a9078d595e255bd7901ac71.html#aefcb89c91a9078d595e255bd7901ac71)).

The client then sends the SGX quote and the serialized key to the attestation service. The attestation service will validate the quote and ensure that the hash of the key is present in the quote and will issue an "Attestation Token".

Expand All @@ -259,11 +261,9 @@ This example shows one common pattern of calling into the attestation service to
This example assumes that you have an existing `AttestationClient` object which is configured with the base URI for your endpoint. It also assumes that you have an SGX Quote (`quote`) generated from within the SGX enclave you are attesting, and "Runtime Data" (`binaryRuntimeData`) which is referenced in the SGX Quote.

```ts
const attestationResult = await client.attestOpenEnclave(
quote,
{
runTimeData: new AttestationData(binaryRuntimeData, false),
});
const attestationResult = await client.attestOpenEnclave(quote, {
runTimeData: new AttestationData(binaryRuntimeData, false)
});
```

If the `isJson` parameter to the `AttestationData` constructor is not provided,
Expand Down Expand Up @@ -323,25 +323,26 @@ If you encounter any bugs or have suggestions, please file an issue in the
section of the project.

<!-- LINKS -->

[source_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/attestation/attestation
[azure_identity]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/2.0.0-beta.3/index.html
[DefaultAzureCredential]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/2.0.0-beta.3/classes/defaultazurecredential.html
[attestation_policy_result]:https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/interfaces/policyresult.html
[defaultazurecredential]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/2.0.0-beta.3/classes/defaultazurecredential.html
[attestation_policy_result]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/interfaces/policyresult.html
[attestation_client]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/classes/attestationclient.html
[attestation_admin_client]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/classes/attestationclient.html
[attestation_response]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/interfaces/attestationresponse.html
[attestation_policy_result_parameters]: https://www.microsoft.com/
[attest_sgx]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/classes/attestation.html#attestsgxenclave
[attestation_npm]: https://www.npmjs.com/package/@azure/attestation
[API_reference]:https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/index.html
[api_reference]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.2/index.html
[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
[microsoft_code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_sub]: https://azure.microsoft.com/free/
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[json_web_token]: https://tools.ietf.org/html/rfc7519
[JWK]: https://tools.ietf.org/html/rfc7517
[jwk]: https://tools.ietf.org/html/rfc7517
[base64url_encoding]: https://tools.ietf.org/html/rfc4648#section-5
[contributing]: https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
Expand Down
8 changes: 6 additions & 2 deletions sdk/containerregistry/container-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ Use the client library for Azure Container Registry to:

### Currently supported environments

- Node.js version 8.x or higher
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.

See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.

### Prerequisites

You need an [Azure subscription][azure_sub] and a [Container Registry account][container_registry_docs] to use this package.
- An [Azure Subscription](https://azure.microsoft.com)
- A [Container Registry account][container_registry_docs]

To create a new Container Registry, you can use the [Azure Portal][container_registry_create_portal],
[Azure PowerShell][container_registry_create_ps], or the [Azure CLI][container_registry_create_cli].
Expand Down
Loading

0 comments on commit b729674

Please sign in to comment.