diff --git a/README.md b/README.md index 85e43a1..68e3426 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ npm install --save ffc-messaging `useCredentialChain` - Boolean value for whether to authenticate connection with using Azure's credential chain. For example, set this to true if you wish to use [AAD Pod Identity](https://github.com/Azure/aad-pod-identity). If `false`, then `username` and `password` or `connectionString` are required. +`managedIdentityClientId` - Client Id of the Workload Identity. Required if using Workload Identity instead of Pod Identity or connection string. + `connectionString` - Azure Service Bus connection string. If provided, `username` and `password` are ignored. `username` - Azure Service Bus Shared Access Key name for authentication. Not required if `useCredentialChain` is `true` or `connectionString` is provided. diff --git a/app/messaging/admin-client.js b/app/messaging/admin-client.js index 4a73d28..545945b 100644 --- a/app/messaging/admin-client.js +++ b/app/messaging/admin-client.js @@ -21,7 +21,11 @@ class AdminClient { } getCredentials () { - return new DefaultAzureCredential() + if (this.config.managedIdentityClientId) { + return new DefaultAzureCredential({ managedIdentityClientId: this.config.managedIdentityClientId }) + } else { + return new DefaultAzureCredential() + } } async getClient () { diff --git a/app/messaging/message-base.js b/app/messaging/message-base.js index 21ce931..c7b30f8 100644 --- a/app/messaging/message-base.js +++ b/app/messaging/message-base.js @@ -21,7 +21,11 @@ class MessageBase { } getCredentials () { - return new DefaultAzureCredential() + if (this.config.managedIdentityClientId) { + return new DefaultAzureCredential({ managedIdentityClientId: this.config.managedIdentityClientId }) + } else { + return new DefaultAzureCredential() + } } async closeConnection () { diff --git a/package-lock.json b/package-lock.json index 71a9109..8820ed2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ffc-messaging", - "version": "2.9.0", + "version": "2.10.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ffc-messaging", - "version": "2.9.0", + "version": "2.10.0", "license": "OGL-UK-3.0", "dependencies": { "@azure/identity": "4.2.1", diff --git a/package.json b/package.json index 764f8d5..422ef20 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ffc-messaging", - "version": "2.9.1", - "description": "Messaging npm module for FFC services", + "version": "2.10.0", + "description": "Messaging npm module for FCP services", "main": "index.js", "repository": { "type": "git",