Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
additional:
Solved! Go to Solution.
Update to this,
I found a reddit post with the same issue,
https://www.reddit.com/r/MicrosoftFabric/comments/1o696yw/the_issue_of_creating_mirrored_databases_u...
Its pointed out that the SAMI needs permission on the mirrored database item.
Also when reading the fine prints in the documentation its stated there as well.
So its really down to me not grasping the details.
Once I added the SAMI to the mirroring object, API works fine for setting up the mirroring.
Thanks @spaceman127 for your time
Update to this,
I found a reddit post with the same issue,
https://www.reddit.com/r/MicrosoftFabric/comments/1o696yw/the_issue_of_creating_mirrored_databases_u...
Its pointed out that the SAMI needs permission on the mirrored database item.
Also when reading the fine prints in the documentation its stated there as well.
So its really down to me not grasping the details.
Once I added the SAMI to the mirroring object, API works fine for setting up the mirroring.
Thanks @spaceman127 for your time
Hi @lobitconsulting ,
Great!
I tested it tonight because the problem kept bothering me, and I encountered exactly what you described.
The permission was missing.
I was able to reproduce it.
Perfect, your problem is solved.
And I'm happy to help when I can.
And feel free to mark the solution and leave some kudos.
Best regards
hi @spaceman127 ,
Tested adding your config, but the result is same as before.
I have a large number of databases, so GUI approach is no option.
Any other suggestions?
Hi @lobitconsulting ,
all right.
I will test it and then let you know if I can reproduce the error. I have also already read up on the API.
If everything goes well, I will get to it in the next few days.
Could you perhaps share your complete code here?
Best regards
Hi @spaceman127
Thanks for your time,
I removed some debug code to make it more compact, but in essence this is my pyspark notebook.
I did not include the connection object, this was created in GUI and I refer to the same connection object both in my GUI test and API test.
When doing the calls I authenticate as myself. The connection object is using service principal towards the database.
import requests, json, base64, uuid
token = mssparkutils.credentials.getToken("pbi")
workspaceId = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
connectionId = "xxxxxxxxxxxxxxxxxxxxxxxxx"
DATABASE = "mirrortesting"
# ====== HEADERS ======
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
# ====== Create Mirroring Variables ======
urlCreateMirror = "https://api.fabric.microsoft.com/v1/workspaces/" + workspaceId + "/mirroredDatabases"
payloadUnencoded = {
"properties": {
"source": {
"type": "AzureSqlDatabase",
"typeProperties": {
"connection": connectionId,
"database": DATABASE
}
},
"target": {
"type": "MountedRelationalDatabase",
"typeProperties": {
"defaultSchema": "dbo",
"format": "Delta",
"landingZone": {
"type": "Managed"
}
}
}
}
}
b64 = base64.b64encode(json.dumps(payloadUnencoded).encode('utf-8')).decode('utf-8')
display_name = f"Mirror Instance {DATABASE}"
body = {
"displayName": display_name,
"description": "Mirror created in notebook",
"definition": {
"parts": [
{
"path": "mirroring.json",
"payload": b64,
"payloadType": "InlineBase64"
}
]
}
}
# ====== Create Mirroring API CALL =====
resp = requests.post(urlCreateMirror, headers=headers, data=json.dumps(body), timeout=120)
mirroredDbId = resp.json()["id"]
time.sleep(20) #wait for Initialized
# ====== Start Mirroring ======
urlStart = "https://api.fabric.microsoft.com/v1/workspaces/" + workspaceId + "/mirroredDatabases/" + mirroredDbId + "/startMirroring"
resp = requests.post(urlStart, headers=headers, data=json.dumps({}), timeout=120)
time.sleep(20) #wait for 'Running'
# ====== Check status ======
urlStatus = "https://api.fabric.microsoft.com/v1/workspaces/" + workspaceId + "/mirroredDatabases/" + mirroredDbId + "/getMirroringStatus"
respStatus = requests.post(urlStatus, headers=headers, data=json.dumps({}), timeout=120)
print(json.dumps(respStatus.json(), indent=2))Hi @lobitconsulting,
I haven't tested it yet, but I think I've read somewhere that you have to specify the landing zone in the API call.
Here's an example. No guarantees, but you can give it a try.
Let us know if it works.
target": {
"type": "MountedRelationalDatabase",
"typeProperties": {
"defaultSchema": "dbo",
"format": "Delta",
"landingZone": {
"type": "Managed"
Best regards
Check out the November 2025 Fabric update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |