An Apache Spark-based analytics platform optimized for Azure.
Hi ,
Thanks for reaching out to Microsoft Q&A.
Yes, there are a few constraints and prerequisites for AD ServicePrincipal authentication with Azure SQL:
- The Azure AD admin must be configured on the Azure SQL Hyperscale server.
- The service principal must be created as a contained user in the Azure SQL db, and must be granted appropriate permissions (
CREATE,INSERT,UPDATE, etc.). - The Databricks cluster must use the correct JDBC driver versionm Microsoft SQL Server JDBC Driver 9.2+ is recommended to avoid authentication bugs.
Should user/password also be included separately as .option() if embedded in JDBC URL?
No, if the credentials are embedded in the jdbc_url, you do not need to pass them again in .option("user", ...) or .option("password", ...).
However, ensure:
- Secrets are retrieved correctly (not empty or expired).
- URL is not accidentally URL-encoded.
- There is no line-break or whitespace in the Key Vault entry.
Is it mandatory to specify the JDBC driver class explicitly?
Not mandatory, but recommended in some environments for stability, especially with custom clusters or older DBR versions.
Is .mode("overwrite") safe and supported for Azure SQL Hyperscale JDBC writes?
Technically supported, but with important caveats:
.mode("overwrite") issues a DROP TABLE + CREATE TABLE + INSERT pattern under the hood.
Azure SQL Hyperscale supports DDL well, but:
Schema recreation might cause issues with foreign keys, indexes, or permissions.
If the table exists and is large, `DROP + CREATE` can lead to long execution times and locking issues.
You may lose constraints, triggers, or computed columns if the schema is not preserved explicitly.
```Best Practice:
- Prefer `.mode("append")` or `.mode("overwrite")` only with staging tables, not production-facing ones.
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.