Skill 2.1.7

Secure model endpoints, including Managed Identity

Key Concepts

The logical server's (or managed instance's) managed identity is granted a role such as Cognitive Services OpenAI User on the Foundry or Azure OpenAI resource. In the database, a DATABASE SCOPED CREDENTIAL named after the endpoint URL uses IDENTITY = 'Managed Identity' and SECRET = '{"resourceid":"https://cognitiveservices.azure.com"}', and the credential is referenced by CREATE EXTERNAL MODEL or by sp_invoke_external_rest_endpoint. On SQL Server 2025, the managed identity comes from Azure Arc, and allow server scoped db credentials must be enabled.

Key-based credentials (IDENTITY = 'HTTPEndpointHeaders' with an api-key) work but must be rotated and protected. Access inside the database is controlled with EXECUTE ON EXTERNAL MODEL, EXECUTE ANY EXTERNAL ENDPOINT and REFERENCES on the credential. In Azure SQL Database, calls go only to allow-listed Azure domains, and outbound firewall rules or a network security perimeter can restrict them further.