Hi Moritz Damm,
Welcome to Microsoft Q&A Forum, thank you for posting your query here!
The error suggests that there might be issues in SQL query syntax or datastore/networking configuration or authentication issue on connecting to SQL database.
Here are the suggested steps to check each steam
1. SQL query syntax
query = """SELECT getdate()""" #contains extra double quotes
to
query = "SELECT GETDATE()" #Validate the query in the SQL server first.
2. On Datastore registration
Please make sure to provide username,password and endpoint details along other details
sql_datastore = Datastore.register_azure_sql_database(
workspace=ws,
datastore_name=sql_datastore_name,
server_name=server_name, # name should not contain fully qualified domain endpoint
database_name=database_name,
username=username,
password=password,
subscription_id="subscription_xxx",
resource_group="resourcegroup_xxx",
grant_workspace_access=True
endpoint='database.windows.net')
3. On Network Security Group
Please make sure provided outbound access to SQL service tag at port 443 from your virtual network in your Network Security Group or firewall.
how-to-access-azureml-behind-firewall
4. Please make sure workspace has been provider reader and contributor access over SQL
5. Managed identity and SQL are in same virtual network and region and DNS resolution is happening for the private resources to their private ip .
how-to-network-security-overview
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful.
Thank you.