I have found the solution. I wasted quite some time on this and I never encountered someone with the same question.
The solution is actually simple, but you need to know.
I have a Service Principal with read access to my storage account.
Create the database like this (don't mention the location):
CREATE DATABASE IF NOT EXISTS datastore_panels
Create the table (use location, but do not set tableproperties or partitioning: it will read this from the delta table metadata):
CREATE TABLE IF NOT EXISTS datastore_panels.customer_data
USING delta
LOCATION '/mnt/readOnlyTraining/delta/customer-data/'
For those that want to understand the question better, this is what I tried before
%sql
CREATE TABLE IF NOT EXISTS datastore_panels.production_bazeilles_press_shopfloor (
reg_id INT,
year INT,
timestamp_utc TIMESTAMP,
unit STRING,
value DECIMAL (18,8),
descr_total STRING,
descr01 STRING,
descr02 STRING,
descr03 STRING,
descr04 STRING,
descr05 STRING,
descr06 STRING,
descr07 STRING,
descr08 STRING,
descr09 STRING,
descr10 STRING
)
USING delta
PARTITIONED BY (year)
LOCATION '/mnt/blob/panels/production/bazeilles/press/shopfloor'
TBLPROPERTIES ('delta.deletedFileRetentionDuration' = "interval 60 days",
'delta.autoOptimize.optimizeWrite' = 'true'
)
This doesn't work because spark will in the end only read, but due to the columns specified, tblproperties and partitionedby spark needs to log to the storage account with only read access that someone tries to change these properties. This logging step is not possible so it gives a "no permission" error back.