Skip to content

Commit

Permalink
fix: support MSI for blob store (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
swatDong committed Jul 26, 2024
1 parent e33d328 commit d8577f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions adaptive-card-notification/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"dependencies": {
"@azure/storage-blob": "^12.9.0",
"@azure/identity": "^4.4.0",
"@microsoft/adaptivecards-tools": "^1.0.0",
"@microsoft/teamsfx": "^2.0.0",
"botbuilder": "^4.18.0"
Expand Down
12 changes: 12 additions & 0 deletions adaptive-card-notification/src/store/blobStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ConversationReference } from "botbuilder";
import { ContainerClient, ContainerListBlobFlatSegmentResponse } from "@azure/storage-blob";
import { ManagedIdentityCredential } from "@azure/identity";
import { ConversationReferenceStore, ConversationReferenceStoreAddOptions, PagedData } from "@microsoft/teamsfx";

// A sample implementation to use Azure Blob Storage as conversation reference store
Expand All @@ -12,6 +13,17 @@ export class BlobStore implements ConversationReferenceStore {
this.client = new ContainerClient(connectionString, containerName);
}

/**
* This implementation uses container URL and managed identity to connect Azure Blob Storage.
* To use this, please follow the steps here (https://learn.microsoft.com/entra/identity-platform/multi-service-web-app-access-storage)
* to enable managed identity and assign the necessary roles.
*
* @param containerUrl - the container URL, e.g. `https://<account>.blob.core.windows.net/<container>`
*/
// constructor(containerUrl: string) {
// this.client = new ContainerClient(containerUrl, new ManagedIdentityCredential());
// }

async get(key: string): Promise<Partial<ConversationReference>> {
await this.initialize();

Expand Down

0 comments on commit d8577f0

Please sign in to comment.