Fix doc warnings in various README files (#22267)
Fixes #22204 Fixes #22205 Fixes #22206
This commit is contained in:
Родитель
a753dec93e
Коммит
4e8d6a3f94
|
@ -105,7 +105,7 @@ export DEBUG=azure:core-amqp:(error|warning),rhea-promise:error,rhea:events,rhea
|
|||
node your-test-script.js &> out.log
|
||||
```
|
||||
|
||||
# Contributing
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Azure Identity Plugin for Token Cache Persistence
|
||||
# Azure Identity Plugin for Token Cache Persistence
|
||||
|
||||
This package provides a plugin to the Azure Identity library for JavaScript ([`@azure/identity`](https://npmjs.com/package/@azure/identity)) that enables persistent token caching. Token cache persistence allows the built-in token cache to persist across sessions using a secure storage system provided by the local operating system.
|
||||
|
||||
|
@ -60,8 +60,8 @@ useIdentityPlugin(cachePersistencePlugin);
|
|||
async function main() {
|
||||
const credential = new DeviceCodeCredential({
|
||||
tokenCachePersistenceOptions: {
|
||||
enabled: true
|
||||
}
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
// We'll use the Microsoft Graph scope as an example
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Azure Identity Plugin for Visual Studio Code Authentication
|
||||
# Azure Identity Plugin for Visual Studio Code Authentication
|
||||
|
||||
This package provides a plugin to the Azure Identity library for JavaScript ([`@azure/identity`](https://npmjs.com/package/@azure/identity)) that enables authentication through the "Azure Account" extension for Visual Studio Code. This plugin provides the dependencies of the `VisualStudioCodeCredential` in `@azure/identity` and enables it for use on its own or as part of `DefaultAzureCredential`.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Azure Identity client library for JavaScript
|
||||
# Azure Identity client library for JavaScript
|
||||
|
||||
The Azure Identity library provides [Azure Active Directory (Azure AD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis) token authentication through a set of convenient [TokenCredential](https://docs.microsoft.com/javascript/api/@azure/core-auth/tokencredential) implementations.
|
||||
|
||||
|
@ -125,7 +125,7 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
|
|||
1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
|
||||
1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
|
||||
1. **Visual Studio Code** - If the developer has authenticated with the [Visual Studio Code Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account), the `DefaultAzureCredential` will authenticate using that account.
|
||||
- In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
|
||||
- In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
|
||||
1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
|
||||
1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
|
||||
|
||||
|
@ -237,7 +237,7 @@ const credential = new ClientSecretCredential(
|
|||
"<YOUR_CLIENT_ID>",
|
||||
"<YOUR_CLIENT_SECRET>",
|
||||
{
|
||||
authorityHost: AzureAuthorityHosts.AzureGovernment
|
||||
authorityHost: AzureAuthorityHosts.AzureGovernment,
|
||||
}
|
||||
);
|
||||
```
|
||||
|
@ -248,35 +248,35 @@ Not all credentials require this configuration. Credentials that authenticate th
|
|||
|
||||
### Authenticating Azure-hosted applications
|
||||
|
||||
| Credential | Usage | Example |
|
||||
| --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`DefaultAzureCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest) | Provides a simplified authentication experience to quickly start developing applications run in the Azure cloud. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
|
||||
| [`ChainedTokenCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/chainedtokencredential?view=azure-node-latest) | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
|
||||
| [`EnvironmentCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest) | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
|
||||
| Credential | Usage | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`DefaultAzureCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest) | Provides a simplified authentication experience to quickly start developing applications run in the Azure cloud. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-defaultazurecredential) |
|
||||
| [`ChainedTokenCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/chainedtokencredential?view=azure-node-latest) | Allows users to define custom authentication flows composing multiple credentials. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#chaining-credentials) |
|
||||
| [`EnvironmentCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest) | Authenticates a service principal or user via credential information specified in environment variables. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-environment-credentials) |
|
||||
| [`ManagedIdentityCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/managedidentitycredential?view=azure-node-latest) | Authenticates the managed identity of an Azure resource. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-in-azure-with-managed-identity) |
|
||||
|
||||
### Authenticating Service Principals
|
||||
|
||||
| Credential | Usage | Example | Reference |
|
||||
| ----------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Credential | Usage | Example | Reference |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`ClientCertificateCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientcertificatecredential?view=azure-node-latest) | Authenticates a service principal using a certificate. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-certificate) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
|
||||
| [`ClientSecretCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientsecretcredential?view=azure-node-latest) | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
|
||||
| [`ClientSecretCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/clientsecretcredential?view=azure-node-latest) | Authenticates a service principal using a secret. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret) | [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) |
|
||||
|
||||
### Authenticating Users
|
||||
|
||||
| Credential | Usage | Example | Reference |
|
||||
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| [`AuthorizationCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/authorizationcodecredential?view=azure-node-latest) | Authenticates a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-auth-code-flow) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
|
||||
| [`DeviceCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/devicecodecredential?view=azure-node-latest) | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-device-code-flow) | [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) |
|
||||
| Credential | Usage | Example | Reference |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| [`AuthorizationCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/authorizationcodecredential?view=azure-node-latest) | Authenticates a user with a previously obtained authorization code. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-auth-code-flow) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
|
||||
| [`DeviceCodeCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/devicecodecredential?view=azure-node-latest) | Interactively authenticates a user on devices with limited UI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-device-code-flow) | [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) |
|
||||
| [`InteractiveBrowserCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/interactivebrowsercredential?view=azure-node-latest) | Interactively authenticates a user with the default system browser. Read more about how this happens [here](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/interactive-browser-credential.md). | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-interactively-in-the-browser) | [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
|
||||
| [`OnBehalfOfCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/onbehalfofcredential?view=azure-node-latest) | Propagates the delegated user identity and permissions through the request chain |
|
||||
| [`UsernamePasswordCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest) | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-username-and-password) | [Username + password authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth-ropc) |
|
||||
| [`OnBehalfOfCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/onbehalfofcredential?view=azure-node-latest) | Propagates the delegated user identity and permissions through the request chain |
|
||||
| [`UsernamePasswordCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest) | Authenticates a user with a username and password. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-username-and-password) | [Username + password authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth-ropc) |
|
||||
|
||||
### Authenticating via Development Tools
|
||||
|
||||
| Credential | Usage | Example | Reference |
|
||||
| --------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| [`AzureCliCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest) | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://docs.microsoft.com/cli/azure/authenticate-azure-cli) |
|
||||
| Credential | Usage | Example | Reference |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| [`AzureCliCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest) | Authenticate in a development environment with the Azure CLI. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-cli) | [Azure CLI authentication](https://docs.microsoft.com/cli/azure/authenticate-azure-cli) |
|
||||
| [`AzurePowerShellCredential`](https://docs.microsoft.com/javascript/api/@azure/identity/azurepowershellcredential?view=azure-node-latest) | Authenticate in a development environment using Azure PowerShell. | [example](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-user-account-with-azure-powershell) | [Azure PowerShell authentication](https://docs.microsoft.com/powershell/azure/authenticate-azureps) |
|
||||
|
||||
## Troubleshooting
|
||||
|
@ -290,7 +290,7 @@ Credentials raise `AuthenticationError` when they fail to authenticate. This cla
|
|||
Enabling logging may help uncover useful information about failures.
|
||||
|
||||
To see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`.
|
||||
You can read this environment variable from the *.env* file by explicitly specifying a file path:
|
||||
You can read this environment variable from the _.env_ file by explicitly specifying a file path:
|
||||
|
||||
```javascript
|
||||
require("dotenv").config({ path: ".env" });
|
||||
|
@ -303,7 +303,7 @@ import { setLogLevel } from "@azure/logger";
|
|||
|
||||
setLogLevel("info");
|
||||
```
|
||||
|
||||
|
||||
In cases where the authenticate code might be running in an environment with more than one credential available,
|
||||
the `@azure/identity` package offers a unique form of logging. On the optional parameters for every credential,
|
||||
developers can set `allowLoggingAccountIdentifiers` to true in the
|
||||
|
@ -319,7 +319,7 @@ import { setLogLevel } from "@azure/logger";
|
|||
setLogLevel("info");
|
||||
|
||||
const credential = new DefaultAzureCredential({
|
||||
loggingOptions: { allowLoggingAccountIdentifiers: true }
|
||||
loggingOptions: { allowLoggingAccountIdentifiers: true },
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
|
||||
This package contains an isomorphic Client Library for Azure IoT Models Repository in JavaScript. Use the Azure IoT Models Repository library for JavaScript to pull DTDL files from remote endpoints.
|
||||
|
||||
|
||||
Key links:
|
||||
|
||||
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iot/iot-modelsrepository)
|
||||
- [Package (npm)](https://www.npmjs.com/package/@azure/iot-modelsrepository/)
|
||||
- Samples
|
||||
|
||||
|
||||
# Getting started
|
||||
## Getting started
|
||||
|
||||
## Key concepts
|
||||
|
||||
|
@ -30,10 +29,9 @@ The preferred way to install the Azure IoT Models Repository client library for
|
|||
npm install @azure/iot-modelsrepository
|
||||
```
|
||||
|
||||
# Examples
|
||||
## Examples
|
||||
|
||||
|
||||
## Initializing the Models Repository Client
|
||||
### Initializing the Models Repository Client
|
||||
|
||||
```ts
|
||||
// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint
|
||||
|
@ -44,18 +42,22 @@ const { ModelsRepositoryClient } = require("@azure/iot-modelsrepository");
|
|||
const client = new ModelsRepositoryClient();
|
||||
console.log(`Initialized client point to global endpoint: ${client.repositoryLocation}`);
|
||||
```
|
||||
|
||||
```ts
|
||||
// The client will also work with a local filesystem URI. This example shows initalization
|
||||
// with a local URI and disabling model dependency resolution.
|
||||
const client = new ModelsRepositoryClient({repositoryLocation: 'file:///path/to/repository/', dependencyResolution: 'disabled'});
|
||||
const client = new ModelsRepositoryClient({
|
||||
repositoryLocation: "file:///path/to/repository/",
|
||||
dependencyResolution: "disabled",
|
||||
});
|
||||
console.log(`Initialized client pointing to local path: ${client.repositoryLocation}`);
|
||||
```
|
||||
|
||||
## Publish Models
|
||||
### Publish Models
|
||||
|
||||
Publishing models to the models repository requires [exercising](https://docs.microsoft.com/azure/iot-pnp/concepts-model-repository#publish-a-model) common GitHub workflows.
|
||||
|
||||
## Get Models
|
||||
### Get Models
|
||||
|
||||
After publishing, your model(s) will be available for consumption from the global repository endpoint. The following snippet shows how to retrieve the corresponding JSON-LD content.
|
||||
|
||||
|
@ -67,7 +69,7 @@ const client = new ModelsRepositoryClient();
|
|||
// If the model dependency resolution configuration is not disabled, then models in which the
|
||||
// target dtmi depends on will also be included in the returned object (mapping dtmis to model objects).
|
||||
const dtmi = "dtmi:com:example:TemperatureController;1";
|
||||
const models = await client.getModels(dtmi, {dependencyResolution: 'tryFromExpanded'});
|
||||
const models = await client.getModels(dtmi, { dependencyResolution: "tryFromExpanded" });
|
||||
|
||||
// In this case the above dtmi has 2 model dependencies.
|
||||
// dtmi:com:example:Thermostat;1 and dtmi:azure:DeviceManagement:DeviceInformation;1
|
||||
|
@ -99,7 +101,10 @@ You are also able to get definitions for multiple root models at a time by lever
|
|||
// Global endpoint client
|
||||
const client = new ModelsRepositoryClient();
|
||||
|
||||
const dtmis = ["dtmi:com:example:TemperatureController;1", "dtmi:com:example:azuresphere:sampledevice;1"];
|
||||
const dtmis = [
|
||||
"dtmi:com:example:TemperatureController;1",
|
||||
"dtmi:com:example:azuresphere:sampledevice;1",
|
||||
];
|
||||
const models = await client.getModels(dtmis);
|
||||
|
||||
// In this case the dtmi "dtmi:com:example:TemperatureController;1" has 2 model dependencies
|
||||
|
@ -108,11 +113,11 @@ const models = await client.getModels(dtmis);
|
|||
console.log(`${dtmis.toString()} resolved in ${models.keys().length} interfaces.`);
|
||||
```
|
||||
|
||||
## Digital Twins Model Parser Integration
|
||||
### Digital Twins Model Parser Integration
|
||||
|
||||
*When the Digital Twins Model Parser is completed, we will update you with information on how to integrate this client.*
|
||||
_When the Digital Twins Model Parser is completed, we will update you with information on how to integrate this client._
|
||||
|
||||
## DtmiConventions utility functions
|
||||
### DtmiConventions utility functions
|
||||
|
||||
The IoT Models Repository applies a set of conventions for organizing digital twin models. This package exposes two auxiliary functions related to `DtmiConventions`, `getModelUri` and `isValidDtmi`. These same functions are used throughout the client.
|
||||
|
||||
|
@ -131,38 +136,42 @@ isValidDtmi("dtmi:com:example:Thermostat");
|
|||
|
||||
// Local repository example
|
||||
const localRepositoryUri: string = "file:///path/to/repository/";
|
||||
const fullyQualifiedModelPath: string =
|
||||
getModelUri("dtmi:com:example:Thermostat;1", localRepositoryUri);
|
||||
const fullyQualifiedModelPath: string = getModelUri(
|
||||
"dtmi:com:example:Thermostat;1",
|
||||
localRepositoryUri
|
||||
);
|
||||
|
||||
// Prints '/path/to/repository/dtmi/com/example/thermostat-1.json'
|
||||
console.log(fullyQualifiedModelPath);
|
||||
|
||||
// Remote repository example
|
||||
const remoteRepositoryUri: string = "https://contoso.com/models/";
|
||||
const fullyQualifiedModelPath: string =
|
||||
GetModelUri("dtmi:com:example:Thermostat;1", remoteRepositoryUri);
|
||||
const fullyQualifiedModelPath: string = GetModelUri(
|
||||
"dtmi:com:example:Thermostat;1",
|
||||
remoteRepositoryUri
|
||||
);
|
||||
|
||||
// Prints 'https://contoso.com/models/dtmi/com/example/thermostat-1.json'
|
||||
console.log(fullyQualifiedModelPath);
|
||||
```
|
||||
|
||||
-----------------------------------------
|
||||
---
|
||||
|
||||
# Troubleshooting
|
||||
## Troubleshooting
|
||||
|
||||
- If you run into an error, first make sure the model you are access exists at the location you are attempting to get it from.
|
||||
|
||||
# Next steps
|
||||
## Next steps
|
||||
|
||||
- Review the [DTDL Spec](https://docs.microsoft.com/azure/iot-pnp/concepts-model-parser).
|
||||
- Understand the [Device Models Repository](https://devicemodels.azure.com/).
|
||||
- Code a IoT Plug and Play 'Device' using the [Azure IoT SDK for Node](https://github.com/Azure/azure-iot-sdk-node/tree/master/device/samples#plug-and-play-examples).
|
||||
- Code a IoT Plug and Play 'Device' using the [Azure IoT SDK for Node](https://github.com/Azure/azure-iot-sdk-node/tree/master/device/samples#plug-and-play-examples).
|
||||
|
||||
# Related projects
|
||||
## Related projects
|
||||
|
||||
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
|
||||
|
||||
# Contributing
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Azure Key Vault client libraries for for JavaScript
|
||||
# Azure Key Vault client libraries for JavaScript
|
||||
|
||||
[Azure Key Vault](https://azure.microsoft.com/services/key-vault/) is a Microsoft-managed service providing cloud keys, secrets, and certificate storage and utility that is highly available, secure, durable, scalable, and redundant.
|
||||
|
||||
|
@ -15,12 +15,12 @@ To manage your Azure Key Vault resources via the Azure Resource Manager, you wou
|
|||
There are three packages to work with Key Vault keys, secrets and certificates respectively.
|
||||
A fourth package, `@azure/keyvault-admin` is also available for administrative tasks on your Key Vault instance.
|
||||
|
||||
| NPM Package | Reference | Samples |
|
||||
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| NPM Package | Reference | Samples |
|
||||
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@azure/keyvault-keys](https://npmjs.com/package/@azure/keyvault-keys) | [API Reference for @azure/keyvault-keys](https://docs.microsoft.com/javascript/api/@azure/keyvault-keys) | [Samples for working with keys](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/keyvault-keys/samples) |
|
||||
| [@azure/keyvault-secrets](https://npmjs.com/package/@azure/keyvault-secrets) | [API Reference for @azure/keyvault-secrets](https://docs.microsoft.com/javascript/api/@azure/keyvault-secrets) | [Samples for working with secrets](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/keyvault-secrets/samples) |
|
||||
| [@azure/keyvault-certificates](https://npmjs.com/package/@azure/keyvault-certificates) | [API Reference for @azure/keyvault-certificates](https://docs.microsoft.com/javascript/api/@azure/keyvault-certificates) | [Samples for working with certificates](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/keyvault-certificates/samples) |
|
||||
| [@azure/keyvault-admin](https://npmjs.com/package/@azure/keyvault-admin) | [API Reference for @azure/keyvault-admin](https://docs.microsoft.com/javascript/api/@azure/keyvault-admin) | [Samples for administrative tasks](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/keyvault-admin/samples) |
|
||||
| [@azure/keyvault-admin](https://npmjs.com/package/@azure/keyvault-admin) | [API Reference for @azure/keyvault-admin](https://docs.microsoft.com/javascript/api/@azure/keyvault-admin) | [Samples for administrative tasks](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/keyvault-admin/samples) |
|
||||
|
||||
### Features
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Azure StorageManagementClient SDK for JavaScript
|
||||
# Azure StorageManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for StorageManagementClient.
|
||||
|
||||
|
@ -31,18 +31,25 @@ npm install @azure/ms-rest-nodeauth
|
|||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { StorageManagementClient, StorageManagementModels, StorageManagementMappers } from "@azure/arm-storage-profile-2019-03-01-hybrid";
|
||||
import {
|
||||
StorageManagementClient,
|
||||
StorageManagementModels,
|
||||
StorageManagementMappers,
|
||||
} from "@azure/arm-storage-profile-2019-03-01-hybrid";
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new StorageManagementClient(creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
msRestNodeAuth
|
||||
.interactiveLogin()
|
||||
.then((creds) => {
|
||||
const client = new StorageManagementClient(creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and list operations as an example written in JavaScript.
|
||||
|
@ -58,6 +65,7 @@ npm install @azure/ms-rest-browserauth
|
|||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -71,21 +79,27 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
|
|||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenant: "<optional tenant for your organization>",
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmStorageProfile20190301Hybrid.StorageManagementClient(res.creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmStorageProfile20190301Hybrid.StorageManagementClient(
|
||||
res.creds,
|
||||
subscriptionId
|
||||
);
|
||||
client.operations
|
||||
.list()
|
||||
.then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
@ -97,5 +111,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
|
|||
|
||||
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
|
||||
|
||||
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fstorage%2Farm-storage-profile-2019-03-01-hybrid%2FREADME.png)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Azure DataLakeStorageClient SDK for JavaScript
|
||||
# Azure DataLakeStorageClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for DataLakeStorageClient.
|
||||
|
||||
|
@ -18,8 +18,8 @@ npm install @azure/storage-datalake
|
|||
#### nodejs - Authentication, client creation and list filesystem as an example written in TypeScript.
|
||||
|
||||
##### Sample code
|
||||
This sample lists the file systems in your storage account. To know more, refer to the [Azure Documentation on Storage DataLake](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-introduction)
|
||||
|
||||
This sample lists the file systems in your storage account. To know more, refer to the [Azure Documentation on Storage DataLake](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-introduction)
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
|
@ -32,13 +32,13 @@ const accountName = "YOUR_STORAGE_ACCOUNTNAME";
|
|||
const client = new DataLakeStorageClient(credentials, accountName);
|
||||
client.filesystem
|
||||
.list()
|
||||
.then(results => {
|
||||
results.forEach(result => {
|
||||
.then((results) => {
|
||||
results.forEach((result) => {
|
||||
console.log(`Name: ${result.name}`);
|
||||
console.log(`Last Modified: ${result.lastModified}`);
|
||||
});
|
||||
})
|
||||
.catch(ex => {
|
||||
.catch((ex) => {
|
||||
console.log(ex);
|
||||
});
|
||||
```
|
||||
|
@ -48,6 +48,7 @@ client.filesystem
|
|||
##### Sample code
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -61,20 +62,17 @@ client.filesystem
|
|||
const credentials = new msRest.TokenCredentials(token);
|
||||
const accountName = "YOUR_STORAGE_ACCOUNTNAME";
|
||||
|
||||
const client = new Azure.StorageDatalake.DataLakeStorageClient(
|
||||
credentials,
|
||||
accountName
|
||||
);
|
||||
const client = new Azure.StorageDatalake.DataLakeStorageClient(credentials, accountName);
|
||||
|
||||
client.filesystem
|
||||
.list()
|
||||
.then(results => {
|
||||
results.forEach(result => {
|
||||
.then((results) => {
|
||||
results.forEach((result) => {
|
||||
console.log(`Name: ${result.name}`);
|
||||
console.log(`Last Modified: ${result.lastModified}`);
|
||||
});
|
||||
})
|
||||
.catch(ex => {
|
||||
.catch((ex) => {
|
||||
console.log(ex);
|
||||
});
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче