[英]Connecting Azure SQL database using managed identity from container instance
I want to connect Azure SQL server instance using managed identity from Container Instance application which is running R script on ubuntu container. I want to connect Azure SQL server instance using managed identity from Container Instance application which is running R script on ubuntu container.
Currently I am using DBI package with odbc driver to connect using SQL login, but would like to get rid off using separate SQL logins for apps. Currently I am using DBI package with odbc driver to connect using SQL login, but would like to get rid off using separate SQL logins for apps.
You can assign System-Assigned Managed Identity for your Container Instance您可以为您的容器实例分配系统分配的托管标识
Go to your Azure Container Instance --> Select Identity under Settings --> Enable System-Assigned status as ON and click on save Go 到您的 Azure 容器实例 --> Select Identity 在 Settings --> Enable System-Assigned 状态为 ON 并点击保存
Go to your Azure SQL server --> Select Access Control --> Select Add Role Assignment --> Select your Container Instance Object --> Assign the required role Go to your Azure SQL server --> Select Access Control --> Select Add Role Assignment --> Select your Container Instance Object --> Assign the required role
Now, you can use Managed Identity to connect to Azure SQL database from your container instance现在,您可以使用托管身份从您的容器实例连接到 Azure SQL 数据库
You do not need to provide any additional credentials您无需提供任何其他凭据
You can use get_managed_token() in your script to connect to Azure SQL Database您可以在脚本中使用get_managed_token()连接到 Azure SQL 数据库
By default, get_managed_token retrieves a token using the system-assigned identity for the resource.默认情况下, get_managed_token使用系统分配的资源标识检索令牌。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.