Skip to main content Skills Marketplace Discover and explore AI skills built by the community.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Copy promptShow prompt details A direct command skips the review prompt. Inspect the source before running it.
npx skills add https://github.com/BEKO2210/Firstbrain --skill azure-identity-tsThe command stays on one line. Scroll horizontally to inspect it before copying.
Prefer a local copy? Download the files currently available to SkillsMP.
Download Zip Downloading... More from this repository Related occupations SOC
Based on SOC occupation classification
name azure-identity-ts description Authenticate to Azure services with various credential types. type skill created 2026-02-27T00:00:00.000Z domain cloud-infrastructure category azure risk unknown source community tags ["skill","cloud-infrastructure","azure","identity"]
Azure Identity SDK for TypeScript
Authenticate to Azure services with various credential types.
Installation
npm install @azure/identity
Environment Variables
Service Principal (Secret)
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_SECRET=<client-secret>
Service Principal (Certificate)
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_CERTIFICATE_PATH=/path/to/cert.pem
AZURE_CLIENT_CERTIFICATE_PASSWORD=<optional-password>
Workload Identity (Kubernetes)
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_FEDERATED_TOKEN_FILE=/var/run/secrets/tokens/azure-identity
DefaultAzureCredential (Recommended)
import { DefaultAzureCredential } from "@azure/identity" ;
const credential = new DefaultAzureCredential ();
import { BlobServiceClient } from "@azure/storage-blob" ;
const blobClient = new BlobServiceClient (
"https://<account>.blob.core.windows.net" ,
credential
);
Credential Chain Order:
EnvironmentCredential
WorkloadIdentityCredential
ManagedIdentityCredential
VisualStudioCodeCredential
AzureCliCredential
AzurePowerShellCredential
AzureDeveloperCliCredential
Managed Identity
System-Assigned
import { ManagedIdentityCredential } from "@azure/identity" ;
const credential = new ManagedIdentityCredential ();
User-Assigned (by Client ID) const credential = new ManagedIdentityCredential ({
clientId : "<user-assigned-client-id>"
});
User-Assigned (by Resource ID) const credential = new ManagedIdentityCredential ({
resourceId : "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<name>"
});
Service Principal
Client Secret import { ClientSecretCredential } from "@azure/identity" ;
const credential = new ClientSecretCredential (
"<tenant-id>" ,
"<client-id>" ,
"<client-secret>"
);
Client Certificate import { ClientCertificateCredential } from "@azure/identity" ;
const credential = new ClientCertificateCredential (
"<tenant-id>" ,
"<client-id>" ,
{ certificatePath : "/path/to/cert.pem" }
);
const credentialWithPwd = new ClientCertificateCredential (
"<tenant-id>" ,
"<client-id>" ,
{
certificatePath : "/path/to/cert.pem" ,
certificatePassword : "<password>"
}
);
Interactive Authentication
Browser-Based Login import { InteractiveBrowserCredential } from "@azure/identity" ;
const credential = new InteractiveBrowserCredential ({
clientId : "<client-id>" ,
tenantId : "<tenant-id>" ,
loginHint : "user@example.com"
});
Device Code Flow import { DeviceCodeCredential } from "@azure/identity" ;
const credential = new DeviceCodeCredential ({
clientId : "<client-id>" ,
tenantId : "<tenant-id>" ,
userPromptCallback : (info ) => {
console .log (info.message );
}
});
Custom Credential Chain import {
ChainedTokenCredential ,
ManagedIdentityCredential ,
AzureCliCredential
} from "@azure/identity" ;
const credential = new ChainedTokenCredential (
new ManagedIdentityCredential (),
new AzureCliCredential ()
);
Developer Credentials
Azure CLI import { AzureCliCredential } from "@azure/identity" ;
const credential = new AzureCliCredential ();
Azure Developer CLI import { AzureDeveloperCliCredential } from "@azure/identity" ;
const credential = new AzureDeveloperCliCredential ();
Azure PowerShell import { AzurePowerShellCredential } from "@azure/identity" ;
const credential = new AzurePowerShellCredential ();
Sovereign Clouds import { ClientSecretCredential , AzureAuthorityHosts } from "@azure/identity" ;
const credential = new ClientSecretCredential (
"<tenant>" , "<client>" , "<secret>" ,
{ authorityHost : AzureAuthorityHosts .AzureGovernment }
);
const credentialChina = new ClientSecretCredential (
"<tenant>" , "<client>" , "<secret>" ,
{ authorityHost : AzureAuthorityHosts .AzureChina }
);
Bearer Token Provider import { DefaultAzureCredential , getBearerTokenProvider } from "@azure/identity" ;
const credential = new DefaultAzureCredential ();
const getAccessToken = getBearerTokenProvider (
credential,
"https://cognitiveservices.azure.com/.default"
);
const token = await getAccessToken ();
Key Types import type {
TokenCredential ,
AccessToken ,
GetTokenOptions
} from "@azure/core-auth" ;
import {
DefaultAzureCredential ,
DefaultAzureCredentialOptions ,
ManagedIdentityCredential ,
ClientSecretCredential ,
ClientCertificateCredential ,
InteractiveBrowserCredential ,
ChainedTokenCredential ,
AzureCliCredential ,
AzurePowerShellCredential ,
AzureDeveloperCliCredential ,
DeviceCodeCredential ,
AzureAuthorityHosts
} from "@azure/identity" ;
Custom Credential Implementation import type { TokenCredential , AccessToken , GetTokenOptions } from "@azure/core-auth" ;
class CustomCredential implements TokenCredential {
async getToken (
scopes : string | string [],
options ?: GetTokenOptions
): Promise <AccessToken | null > {
return {
token : "<access-token>" ,
expiresOnTimestamp : Date .now () + 3600000
};
}
}
Debugging import { setLogLevel, AzureLogger } from "@azure/logger" ;
setLogLevel ("verbose" );
AzureLogger .log = (...args ) => {
console .log ("[Azure]" , ...args);
};
Best Practices
Use DefaultAzureCredential - Works in development (CLI) and production (managed identity)
Never hardcode credentials - Use environment variables or managed identity
Prefer managed identity - No secrets to manage in production
Scope credentials appropriately - Use user-assigned identity for multi-tenant scenarios
Handle token refresh - Azure SDK handles this automatically
Use ChainedTokenCredential - For custom fallback scenarios
When to Use This skill is applicable to execute the workflow or actions described in the overview.
Connections
Domain: [[Cloud & Infrastruktur]]
Kategorie: [[Microsoft Azure]]
Navigation: [[Skills Uebersicht]], [[Home]]