当前位置: 首页 > backend >正文

How to Use Managed Identity with ACS?

Overview

ACS is a fully managed(托管)communication platform. By using managed identity with ACS , we can simplify the authentication process for our ACS application, while also increasing its security. Eliminating the need to managed our own access tokens and credentials.

Two identities

ACS supports two types of managed identity to authenticate with the service.

  • A System Assigned Identity which is tied to the ACS resource.
  • A User Assigned Identity which is an Azure resource that can be assigned to the ACS resource.

How to use managed identity with ACS

  1. Grant the managed identity access to the ACS resource by the Azure portal, Azure CLI, and the ACS Management SDKs.
  2. Use the managed identity to authenticate with ACS by the Azure SDKs or REST APIs.
const { EmailClient, KnownEmailSendStatus } = require("@azure/communication-email"); 
// system assigned 
//const { DefaultAzureCredential } = require("@azure/identity"); // user assigned 
const { ManagedIdentityCredential } = require("@azure/identity"); 
const userAssignedClientId = "xxxx"; // 替换为你的用户分配身份的客户端 ID 
const endpoint = "xxxx"; // system assigned 
//let credential = new DefaultAzureCredential(); // user assigned 
let credential = new ManagedIdentityCredential(userAssignedClientId); 
// Create an instance of ManagedIdentityCredential with an object ID. 
// Options for configuring the resource which makes the access token request; 
// Refer to js SDK cosntructor details// Create the email client with authentication
const emailClient = new EmailClient(endpoint, credential); 
  • Note: There are a few different options available for authentication an email client: Connection String, Microsoft Entra ID, AzureKeyCredential. We use MS Extra ID here.

Reference

  • ACS - Enable managed identity
  • ACS - Send Email
  • JS SDK - ManagedIdentityCredential
http://www.xdnf.cn/news/18551.html

相关文章:

  • XCVU13P-2FHGB2104E Xilinx(AMD)Virtex UltraScale+ FPGA
  • MySQL索引原理与优化全解析
  • 55.Redis搭建主从架构
  • ANSI终端色彩控制知识散播(II):封装的层次(Python)——不同的逻辑“一样”的预期
  • 【C初阶】自定义类型--结构体
  • Java:对象的浅拷贝与深拷贝
  • 探索 List 的奥秘:自己动手写一个 STL List✨
  • 基于JSqlParser的SQL语句分析与处理
  • 网址账号正确,密码错误返回的状态码是多少
  • Go语言数据结构与算法-基础数据结构
  • Compose笔记(四十七)--SnackbarHost
  • Axure:有个特别实用的功能
  • 什么是AI宠物
  • [2025CVPR-目标检测方向]PointSR:用于无人机视图物体检测的自正则化点监控
  • C++的struct里面可以放函数,讨论一下C++和C关于struct的使用区别
  • leetcode算法刷题的第十六天
  • 力扣热题之技巧
  • 雷卯针对香橙派Orange Pi 3G-IoT-B开发板防雷防静电方案
  • 云原生、容器及数据中心网络相关名词记录
  • 无人机光伏巡检误检率↓79%!陌讯多模态融合算法在组件缺陷检测的落地优化
  • 为什么存入数据库的中文会变成乱码
  • 浙江龙庭翔新型建筑材料有限公司全屋定制:畅享品质生活新境界!
  • 【小沐学GIS】基于C++绘制三维数字地球Earth(osgEarth、三维瓦片地球)第十期
  • 如何使用和优化SQL Server存储过程:全面指南
  • PETR/PETRv2
  • 从 M4S 到 MP4:用 FFmpeg 轻松合并音视频文件
  • C++矩阵类设计与实现:高效、健壮的线性代数工具
  • 2025年音乐创作大模型有哪些?国内国外模型汇总以及优点分析
  • 5G物联网的现实与未来:CTO视角下的成本、风险与破局点
  • Stm32通过ESP8266 WiFi连接阿里云平台