-- Replace with the Azure OpenAI resource name. -- The Fabric SQL managed identity must have the Cognitive Services OpenAI User role. IF EXISTS ( SELECT 1 FROM sys.database_scoped_credentials WHERE name = 'https://.openai.azure.com' ) DROP DATABASE SCOPED CREDENTIAL [https://.openai.azure.com]; GO CREATE DATABASE SCOPED CREDENTIAL [https://.openai.azure.com] WITH IDENTITY = 'Managed Identity', SECRET = '{"resourceid":"https://cognitiveservices.azure.com"}'; GO