Observação
O acesso a essa página exige autorização. Você pode tentar entrar ou alterar diretórios.
O acesso a essa página exige autorização. Você pode tentar alterar os diretórios.
Este pacote contém um SDK isomórfico (executado em Node.js e em navegadores) para o cliente Azure ManagedServiceIdentity.
O cliente de identidade de serviço gerenciado.
Source code | Package (NPM) | API reference documentation | Samples
Getting started
Ambientes com suporte no momento
- Versões LTS do Node.js
- Versões mais recentes do Safari, Chrome, Edge e Firefox.
See our support policy for more details.
Prerequisites
Instalar o pacote @azure/arm-msi
Instale a biblioteca de clientes ManagedServiceIdentity do Azure para JavaScript com npm:
npm install @azure/arm-msi
Criar e autenticar um ManagedServiceIdentityClient
Para criar um objeto de cliente para acessar a API ManagedServiceIdentity do Azure, você precisará do endpoint recurso ManagedServiceIdentity do Azure e de um credentialarquivo . O cliente Azure ManagedServiceIdentity pode usar as credenciais do Azure Active Directory para autenticar.
You can find the endpoint for your Azure ManagedServiceIdentity resource in the Azure Portal.
You can authenticate with Azure Active Directory using a credential from the @azure/identity library or an existing AAD Token.
To use the DefaultAzureCredential provider shown below, or other credential providers provided with the Azure SDK, please install the @azure/identity package:
npm install @azure/identity
Você também precisará registrar um novo aplicativo do AAD e conceder acesso ao Azure ManagedServiceIdentity atribuindo a função adequada à entidade de serviço (observação: funções como não "Owner" concederão as permissões necessárias).
For more information about how to create an Azure AD Application check out this guide.
Usando ambientes semelhantes a Node.js e nó, você pode usar a classe DefaultAzureCredential para autenticar o cliente.
import { ManagedServiceIdentityClient } from "@azure/arm-msi";
import { DefaultAzureCredential } from "@azure/identity";
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ManagedServiceIdentityClient(new DefaultAzureCredential(), subscriptionId);
Para ambientes de navegador, use o InteractiveBrowserCredential do pacote @azure/identity para autenticar.
import { InteractiveBrowserCredential } from "@azure/identity";
import { ManagedServiceIdentityClient } from "@azure/arm-msi";
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const credential = new InteractiveBrowserCredential({
tenantId: "<YOUR_TENANT_ID>",
clientId: "<YOUR_CLIENT_ID>",
});
const client = new ManagedServiceIdentityClient(credential, subscriptionId);
JavaScript Bundle
Para usar essa biblioteca de clientes no navegador, primeiro você precisa usar um empacotador. For details on how to do this, please refer to our bundling documentation.
Key concepts
ManagedServiceIdentityClient
ManagedServiceIdentityClient é a interface principal para desenvolvedores que usam a biblioteca de clientes ManagedServiceIdentity do Azure. Explore os métodos nesse objeto de cliente para entender os diferentes recursos do serviço ManagedServiceIdentity do Azure que você pode acessar.
Troubleshooting
Logging
Habilitar o registro em log pode ajudar a descobrir informações úteis sobre falhas. Para ver um log de solicitações e respostas HTTP, defina a variável de AZURE_LOG_LEVEL ambiente como info. Como alternativa, o registro em log pode ser habilitado em runtime chamandosetLogLevel:@azure/logger
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
Para obter instruções mais detalhadas sobre como habilitar logs, você pode examinar os documentos do pacote de @azure/agente.
Next steps
Please take a look at the samples directory for detailed examples on how to use this library.
Contributing
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.
Related projects
Azure SDK for JavaScript