Skill 3.1.2
Create and manage external models
Key Concepts
CREATE EXTERNAL MODEL name WITH (LOCATION = '...', API_FORMAT = 'Azure OpenAI', MODEL_TYPE = EMBEDDINGS, MODEL = 'text-embedding-3-small', CREDENTIAL = [...], PARAMETERS = '{"dimensions":1536}') registers an endpoint. API formats are Azure OpenAI, OpenAI, Ollama and ONNX Runtime (local, on SQL Server 2025 on Windows with LOCAL_RUNTIME_PATH), and the model type is EMBEDDINGS. The location must be HTTPS, and the credential is a database scoped credential whose name matches the endpoint URL, using a managed identity or an API key header. PARAMETERS can also set sql_rest_options.retry_count for transient failures.
Creating or changing models requires CREATE EXTERNAL MODEL or ALTER ANY EXTERNAL MODEL, and using one requires EXECUTE ON EXTERNAL MODEL::name. ALTER EXTERNAL MODEL changes the location, credential or parameters, for example to move to a new deployment without changing code that refers to the model by name, and DROP EXTERNAL MODEL removes it unless a schema-bound view depends on it. sys.external_models lists models. In SQL Server 2025, the external rest endpoint enabled option must be on; in Azure SQL Database it is on by default.