Error in Azure Pipelines when trying to create database contained user in Azure Sql for Azure Function App

I have an Azure Sql server and a specific database where I want to create a contained user representing my Azure Function App.

I have already done the following:

  1. Enabled the system-assigned managed identity (SMI) of both the Azure Sql Server and the Azure Function App resources.
  2. Created an AAD user group and assign it the AAD role Directory Readers and added as a member the service principal of the managed identity of my Azure Sql Server resource.
  3. Created an Azure release pipeline to test that I can run a SQL script to create a db contained user for my Azure Function App. The Azure Pipeline runs with a service connection which has been associated with another Entra ID service principal with access to my resource groups. Inside the Azure Pipeline, I used an Azure SQL Database deployment task setup as follows:
Option Value
Azure Service Connection Type Azure Resource Manager
Azure Subscription I selected a service connection associated with an Entra ID service principal for deploying resources to my selected resource groups
SQL Database
Authentication Type Service Principal
Azure SQL Server ******.database.windows.net
Database ******
Deployment Package
Deploy type Inline SQL Script
Inline SQL Script CREATE USER [my-func-dev-weu] FROM EXTERNAL PROVIDER WITH DEFAULT_SCHEMA = dbo; GO;ALTER ROLE [db_owner] ADD MEMBER [my-func-dev-weu];GO
Firewall
Specify Firewall Rules Using AutoDetect
Delete Rule After Task Ends Checked

When I execute my Azure Pipeline I get back the following error:

Login failed for user '<token-identified principal>'.Check out how to troubleshoot failures at https://aka.ms/sqlazuredeployreadme#troubleshooting

Unfortunately, the troubleshooting guide was not much of help for my issue.

I am a bit confused because although I created the system-assigned managed identity of my Azure Sql server, I have no way of using it (the service principal) to execute my Azure SQL database deployment task. I was under the impression that the service principal authentication will check that the Azure Sql server’s SMI is enabled and it will carry on creating the new contained user.

Next, I tried to manually add the service principal associated with the service connection I use to deploy my resources to Azure and it worked (I had already added the service principal of the service connection to my AAD user group with Directory Readers role), but I don’t like this solution, because it means I shall always have to execute the manual task to add the azure pipeline’s service principal as a contained user to every Azure Sql database I need to be able to create contained users via Azure release Pipeline.

How can I make it work by only using the SMI of the Azure SQL Server when executing the db script within an Azure release Pipeline ?

New contributor

Panayotis Tzedakis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật