Skip to content

Domains

assign_domain_workspaces_by_capacities(domain, capacities)

Assign all workspaces that reside on the specified capacities to the specified domain. Preexisting domain assignments will be overridden unless bulk reassignment is blocked by domain management tenant settings.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain to assign all workspaces.

required
capacities List[str]

A list of capacities IDs to assign.

required

Returns:

Type Description
None

None.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/assign-domain-workspaces-by-capacities

Examples:

assign_domain_workspaces_by_capacities(
    '98f6b7c8-1234-5678-90ab-cdef12345678',
    [
        "e8de1852-7382-480a-8404-d5b1f5e1ab65",
        "5348d3a9-c096-4074-9083-09e3ca69c8e5",
        "ac561643-c5c5-4cf1-868e-8755a90e6fa3"
    ]
)
Source code in src/pyfabricops/core/domains.py
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
def assign_domain_workspaces_by_capacities(
    domain: str, capacities: List[str]
) -> None:
    """
    Assign all workspaces that reside on the specified capacities to the specified domain.
    Preexisting domain assignments will be overridden unless bulk reassignment is blocked by domain management tenant settings.

    Args:
        domain (str): The name or ID of the domain to assign all workspaces.
        capacities (List[str]): A list of capacities IDs to assign.

    Returns:
        None.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/assign-domain-workspaces-by-capacities

    Examples:
        ```python
        assign_domain_workspaces_by_capacities(
            '98f6b7c8-1234-5678-90ab-cdef12345678',
            [
                "e8de1852-7382-480a-8404-d5b1f5e1ab65",
                "5348d3a9-c096-4074-9083-09e3ca69c8e5",
                "ac561643-c5c5-4cf1-868e-8755a90e6fa3"
            ]
        )

        ```
    """
    payload = {'capacitiesIds': capacities}
    return api_request(
        '/admin/domains/'
        + resolve_domain(domain)
        + '/assignWorkspacesByCapacities',
        method='post',
        payload=payload,
        support_lro=True,
    )

assign_domain_workspaces_by_ids(domain, workspaces)

Assign workspaces from the specified domain by workspace ID.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain to unassign all workspaces.

required
workspaces List[str]

A list of workspace IDs to unassign from the domain.

required

Returns:

Type Description
None

None.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/assign-domain-workspaces-by-ids

Examples:

assign_domain_workspaces_by_ids(
    '98f6b7c8-1234-5678-90ab-cdef12345678',
    [
        "e8de1852-7382-480a-8404-d5b1f5e1ab65",
        "5348d3a9-c096-4074-9083-09e3ca69c8e5",
        "ac561643-c5c5-4cf1-868e-8755a90e6fa3"
    ]
)
Source code in src/pyfabricops/core/domains.py
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
def assign_domain_workspaces_by_ids(
    domain: str, workspaces: List[str]
) -> None:
    """
    Assign workspaces from the specified domain by workspace ID.

    Args:
        domain (str): The name or ID of the domain to unassign all workspaces.
        workspaces (List[str]): A list of workspace IDs to unassign from the domain.

    Returns:
        None.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/assign-domain-workspaces-by-ids

    Examples:
        ```python
        assign_domain_workspaces_by_ids(
            '98f6b7c8-1234-5678-90ab-cdef12345678',
            [
                "e8de1852-7382-480a-8404-d5b1f5e1ab65",
                "5348d3a9-c096-4074-9083-09e3ca69c8e5",
                "ac561643-c5c5-4cf1-868e-8755a90e6fa3"
            ]
        )

        ```
    """
    payload = {'workspaceIds': workspaces}
    return api_request(
        '/admin/domains/' + resolve_domain(domain) + '/assignWorkspaces',
        method='post',
        payload=payload,
    )

assign_domain_workspaces_by_principals(domain, principals)

Assign workspaces to the specified domain, when one of the specified principals has admin permission in the workspace. Preexisting domain assignments will be overridden unless bulk reassignment is blocked by domain management tenant settings.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain to assign all workspaces.

required
principals List[str]

The principals that are admins of the workspaces.

required

Returns:

Type Description
None

None.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/assign-domain-workspaces-by-principals

Examples:

assign_domain_workspaces_by_principals(
    '98f6b7c8-1234-5678-90ab-cdef12345678',
    [
        { "id": "e8de1852-7382-480a-8404-d5b1f5e1ab65", "type": "User" },
        { "id": "5348d3a9-c096-4074-9083-09e3ca69c8e5", "type": "ServicePrincipal" }
    ]
)
Source code in src/pyfabricops/core/domains.py
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
def assign_domain_workspaces_by_principals(
    domain: str, principals: List[Dict[str, Any]]
) -> None:
    """
    Assign workspaces to the specified domain, when one of the specified principals has admin permission in the workspace.
    Preexisting domain assignments will be overridden unless bulk reassignment is blocked by domain management tenant settings.

    Args:
        domain (str): The name or ID of the domain to assign all workspaces.
        principals (List[str]): The principals that are admins of the workspaces.

    Returns:
        None.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/assign-domain-workspaces-by-principals

    Examples:
        ```python
        assign_domain_workspaces_by_principals(
            '98f6b7c8-1234-5678-90ab-cdef12345678',
            [
                { "id": "e8de1852-7382-480a-8404-d5b1f5e1ab65", "type": "User" },
                { "id": "5348d3a9-c096-4074-9083-09e3ca69c8e5", "type": "ServicePrincipal" }
            ]
        )

        ```
    """
    payload = {'principals': principals}
    return api_request(
        '/admin/domains/'
        + resolve_domain(domain)
        + '/assignWorkspacesByPrincipals',
        method='post',
        payload=payload,
        support_lro=True,
    )

create_domain(display_name, *, description=None, parent_domain=None, df=True)

Create a new domain in the tenant.

Parameters:

Name Type Description Default
display_name str

The name of the domain to create.

required
description str

The description of the domain to create.

None
parent_domain str

The name or ID of the parent domain.

None
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, Dict[str, Any], None]

The created domain details if successful, otherwise None.

Examples:

create_domain(
    display_name='Newdomain',
    parent_domain_id='456e7890-e12b-34d5-a678-90abcdef1234'
)
Source code in src/pyfabricops/core/domains.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
@df
def create_domain(
    display_name: str,
    *,
    description: str = None,
    parent_domain: str = None,
    df: Optional[bool] = True,
) -> Union[DataFrame, Dict[str, Any], None]:
    """
    Create a new domain in the tenant.

    Args:
        display_name (str): The name of the domain to create.
        description (str): The description of the domain to create.
        parent_domain (str): The name or ID of the parent domain.
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, Dict[str, Any], None]): The created domain details if successful, otherwise None.

    Examples:
        ```python
        create_domain(
            display_name='Newdomain',
            parent_domain_id='456e7890-e12b-34d5-a678-90abcdef1234'
        )
        ```
    """
    payload = {'displayName': display_name}

    if description:
        payload['description'] = description

    if parent_domain:
        payload['parentdomainId'] = resolve_domain(parent_domain)

    return api_request(
        '/admin/domains',
        payload=payload,
        method='post',
    )

delete_domain(domain)

Delete a domain

Parameters:

Name Type Description Default
domain str

The name or ID of the domain to delete.

required

Returns:

Type Description
None

None.

Examples:

delete_domain('98f6b7c8-1234-5678-90ab-cdef12345678')
Source code in src/pyfabricops/core/domains.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
def delete_domain(domain: str) -> None:
    """
    Delete a domain

    Args:
        domain (str): The name or ID of the domain to delete.

    Returns:
        None.

    Examples:
        ```python
        delete_domain('98f6b7c8-1234-5678-90ab-cdef12345678')
        ```
    """
    return api_request(
        '/admin/domains/' + resolve_domain(domain),
        method='delete',
    )

domain_role_assignments_bulk_assign(domain, payload, *, df=True)

Assign the specified admins or contributors to the domain.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain.

required
admins List[str]

A list of user IDs to assign as admins.

required
contributors List[str]

A list of user IDs to assign as contributors.

required
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, List[Dict[str, Any]], None]

A list of role assignments of the domain.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/role-assignments-bulk-assign

Examples:

domain_role_assignments_bulk_assign(
    'Financial',
    {
        "type": "Admins",
        "principals": [
            {
            "id": "796ce6ad-9163-4c16-9559-c68192a251de",
            "type": "User"
            }
        ]
    }
)

domain_role_assignments_bulk_assign(
    'Financial',
    {
        "type": "Contributors",
        "principals": [
            {
                "id": "796ce6ad-9163-4c16-9559-c68192a251de",
                "type": "User"
            }
        ]
    }
)
Source code in src/pyfabricops/core/domains.py
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
@df
def domain_role_assignments_bulk_assign(
    domain: str,
    payload: Dict[str, Any],
    *,
    df: Optional[bool] = True,
) -> Union[DataFrame, List[Dict[str, Any]], None]:
    """
    Assign the specified admins or contributors to the domain.

    Args:
        domain (str): The name or ID of the domain.
        admins (List[str]): A list of user IDs to assign as admins.
        contributors (List[str]): A list of user IDs to assign as contributors.
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, List[Dict[str, Any]], None]): A list of role assignments of the domain.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/role-assignments-bulk-assign

    Examples:
        ```python

        domain_role_assignments_bulk_assign(
            'Financial',
            {
                "type": "Admins",
                "principals": [
                    {
                    "id": "796ce6ad-9163-4c16-9559-c68192a251de",
                    "type": "User"
                    }
                ]
            }
        )

        domain_role_assignments_bulk_assign(
            'Financial',
            {
                "type": "Contributors",
                "principals": [
                    {
                        "id": "796ce6ad-9163-4c16-9559-c68192a251de",
                        "type": "User"
                    }
                ]
            }
        )
        ```
    """
    resp = api_request(
        '/admin/domains/'
        + resolve_domain(domain)
        + '/roleAssignments/bulkAssign',
        method='post',
        payload=payload,
    )
    return resp

domain_role_assignments_bulk_unassign(domain, payload, *, df=True)

Assign the specified admins or contributors to the domain.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain.

required
admins List[str]

A list of user IDs to assign as admins.

required
contributors List[str]

A list of user IDs to assign as contributors.

required
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, List[Dict[str, Any]], None]

A list of role assignments of the domain.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/role-assignments-bulk-unassign

Examples:

domain_role_assignments_bulk_assign(
    'Financial',
    {
        "type": "Admins",
        "principals": [
            {
            "id": "796ce6ad-9163-4c16-9559-c68192a251de",
            "type": "User"
            }
        ]
    }
)

domain_role_assignments_bulk_assign(
    'Financial',
    {
        "type": "Contributors",
        "principals": [
            {
                "id": "796ce6ad-9163-4c16-9559-c68192a251de",
                "type": "User"
            }
        ]
    }
)
Source code in src/pyfabricops/core/domains.py
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
@df
def domain_role_assignments_bulk_unassign(
    domain: str,
    payload: Dict[str, Any],
    *,
    df: Optional[bool] = True,
) -> Union[DataFrame, List[Dict[str, Any]], None]:
    """
    Assign the specified admins or contributors to the domain.

    Args:
        domain (str): The name or ID of the domain.
        admins (List[str]): A list of user IDs to assign as admins.
        contributors (List[str]): A list of user IDs to assign as contributors.
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, List[Dict[str, Any]], None]): A list of role assignments of the domain.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/role-assignments-bulk-unassign

    Examples:
        ```python

        domain_role_assignments_bulk_assign(
            'Financial',
            {
                "type": "Admins",
                "principals": [
                    {
                    "id": "796ce6ad-9163-4c16-9559-c68192a251de",
                    "type": "User"
                    }
                ]
            }
        )

        domain_role_assignments_bulk_assign(
            'Financial',
            {
                "type": "Contributors",
                "principals": [
                    {
                        "id": "796ce6ad-9163-4c16-9559-c68192a251de",
                        "type": "User"
                    }
                ]
            }
        )
        ```
    """
    resp = api_request(
        '/admin/domains/'
        + resolve_domain(domain)
        + '/roleAssignments/bulkUnassign',
        method='post',
        payload=payload,
    )
    return resp

domain_sync_role_assignments_to_subdomain(domain, role='Admin', *, df=True)

Sync the role assignments from the specified domain to its subdomains.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain.

required
role Literal['Admin', 'Contributor']

The role to sync ('Admin' or 'Contributor').

'Admin'
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, List[Dict[str, Any]], None]

The result of the sync operation.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/sync-role-assignments-to-subdomains

Examples:

domain_sync_role_assignments_to_subdomain('Financial', role='Admin')
Source code in src/pyfabricops/core/domains.py
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
@df
def domain_sync_role_assignments_to_subdomain(
    domain: str,
    role: Literal['Admin', 'Contributor'] = 'Admin',
    *,
    df: Optional[bool] = True,
) -> Union[DataFrame, List[Dict[str, Any]], None]:
    """
    Sync the role assignments from the specified domain to its subdomains.

    Args:
        domain (str): The name or ID of the domain.
        role (Literal['Admin', 'Contributor']): The role to sync ('Admin' or 'Contributor').
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, List[Dict[str, Any]], None]): The result of the sync operation.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/sync-role-assignments-to-subdomains

    Examples:
        ```python
        domain_sync_role_assignments_to_subdomain('Financial', role='Admin')
        ```
    """
    payload = {'role': role}
    resp = api_request(
        '/admin/domains/'
        + resolve_domain(domain)
        + '/roleAssignments/syncToSubdomains',
        method='post',
        payload=payload,
    )
    return resp

get_domain(domain, *, df=True)

Get a domain in a workspace.

Parameters:

Name Type Description Default
domain str

The name or id of the domain to get.

required
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, Dict[str, Any], None]

The domain details if found, otherwise None.

Examples:

get_domain(
    domain='98f6b7c8-1234-5678-90ab-cdef12345678'
)
Source code in src/pyfabricops/core/domains.py
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
@df
def get_domain(
    domain: str, *, df: Optional[bool] = True
) -> Union[DataFrame, Dict[str, Any], None]:
    """
    Get a domain in a workspace.

    Args:
        domain (str): The name or id of the domain to get.
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, Dict[str, Any], None]): The domain details if found, otherwise None.

    Examples:
        ```python
        get_domain(
            domain='98f6b7c8-1234-5678-90ab-cdef12345678'
        )
        ```
    """
    return api_request(
        '/admin/domains/' + resolve_domain(domain) + '?preview=false',
    )

get_domain_id(domain_name)

Retrieves the ID of a domain by its name.

Parameters:

Name Type Description Default
domain_name str

The name of the domain.

required

Returns:

Type Description
Union[str, None]

str | None: The ID of the domain if found, otherwise None.

Source code in src/pyfabricops/core/domains.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def get_domain_id(domain_name: str) -> Union[str, None]:
    """
    Retrieves the ID of a domain by its name.

    Args:
        domain_name (str): The name of the domain.

    Returns:
        str | None: The ID of the domain if found, otherwise None.
    """
    domains = list_domains(df=False)
    for _domain in domains:
        if _domain['displayName'] == domain_name:
            return _domain['id']
    logger.warning(f"domain '{domain_name}' not found.")
    return None

list_domain_role_assignments(domain, *, df=True)

Returns a list of the role assignments assigned to the specified domain.

Parameters:

Name Type Description Default
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, List[Dict[str, Any]], None]

A list of role assignments of the domain.

Examples:

list_domain_role_assignments('Financial')
Source code in src/pyfabricops/core/domains.py
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
@df
def list_domain_role_assignments(
    domain: str,
    *,
    df: Optional[bool] = True,
) -> Union[DataFrame, List[Dict[str, Any]], None]:
    """
    Returns a list of the role assignments assigned to the specified domain.

    Args:
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, List[Dict[str, Any]], None]): A list of role assignments of the domain.

    Examples:
        ```python
        list_domain_role_assignments('Financial')
        ```
    """
    resp = api_request(
        '/admin/domains/' + resolve_domain(domain) + '/roleAssignments',
        support_pagination=True,
    )
    return resp

list_domain_workspaces(domain, *, df=True)

Returns a list of the workspaces assigned to the specified domain.

Parameters:

Name Type Description Default
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, List[Dict[str, Any]], None]

A list of domains in the workspace.

Examples:

list_domain_workspaces('Financial')
Source code in src/pyfabricops/core/domains.py
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@df
def list_domain_workspaces(
    domain: str,
    *,
    df: Optional[bool] = True,
) -> Union[DataFrame, List[Dict[str, Any]], None]:
    """
    Returns a list of the workspaces assigned to the specified domain.

    Args:
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, List[Dict[str, Any]], None]): A list of domains in the workspace.

    Examples:
        ```python
        list_domain_workspaces('Financial')
        ```
    """
    resp = api_request(
        '/admin/domains/' + resolve_domain(domain) + '/workspaces',
        support_pagination=True,
    )
    return resp

list_domains(*, non_empty_only=False, df=True)

List domains

Parameters:

Name Type Description Default
non_empty_only Optional[bool]

If True, only returns domains that are not empty.

False
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, List[Dict[str, Any]], None]

A list of domains in the workspace.

Examples:

list_domains() # List all domains
list_domains(non_empty_only=True) # List only non-empty domains
Source code in src/pyfabricops/core/domains.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@df
def list_domains(
    *,
    non_empty_only: Optional[bool] = False,
    df: Optional[bool] = True,
) -> Union[DataFrame, List[Dict[str, Any]], None]:
    """
    List domains

    Args:
        non_empty_only (Optional[bool]): If True, only returns domains that are not empty.
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, List[Dict[str, Any]], None]): A list of domains in the workspace.

    Examples:
        ```python
        list_domains() # List all domains
        list_domains(non_empty_only=True) # List only non-empty domains
        ```
    """
    resp = api_request(
        '/admin/domains',
        params={
            'nonEmptyOnly': str(non_empty_only).lower(),
            'preview': 'false',
        },
        support_pagination=True,
        return_raw=True,
    )
    return resp.json().get('domains', [])

resolve_domain(domain)

Resolves a domain name to its ID.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain.

required

Returns:

Type Description
Union[str, None]

str | None: The ID of the domain if found, otherwise None.

Source code in src/pyfabricops/core/domains.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def resolve_domain(domain: str) -> Union[str, None]:
    """
    Resolves a domain name to its ID.

    Args:
        domain (str): The name or ID of the domain.

    Returns:
        str | None: The ID of the domain if found, otherwise None.
    """
    if is_valid_uuid(domain):
        return domain
    else:
        return get_domain_id(domain)

unassign_all_domain_workspaces(domain)

Unassign all workspaces from the specified domain.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain to unassign all workspaces.

required

Returns:

Type Description
None

None.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/unassign-all-domain-workspaces

Examples:

unassign_all_domain_workspaces('98f6b7c8-1234-5678-90ab-cdef12345678')
Source code in src/pyfabricops/core/domains.py
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
def unassign_all_domain_workspaces(domain: str) -> None:
    """
    Unassign all workspaces from the specified domain.

    Args:
        domain (str): The name or ID of the domain to unassign all workspaces.

    Returns:
        None.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/unassign-all-domain-workspaces

    Examples:
        ```python
        unassign_all_domain_workspaces('98f6b7c8-1234-5678-90ab-cdef12345678')

        ```
    """
    return api_request(
        '/admin/domains/' + resolve_domain(domain) + '/unassignAllWorkspaces',
        method='post',
    )

unassign_domain_workspaces_by_ids(domain, workspaces)

Unassign workspaces from the specified domain by workspace ID.

Parameters:

Name Type Description Default
domain str

The name or ID of the domain to unassign all workspaces.

required
workspaces List[str]

A list of workspace IDs to unassign from the domain.

required

Returns:

Type Description
None

None.

Fabric Rest API Reference

https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/unassign-domain-workspaces-by-ids

Examples:

unassign_domain_workspaces_by_ids(
    '98f6b7c8-1234-5678-90ab-cdef12345678',
    [
        "e8de1852-7382-480a-8404-d5b1f5e1ab65",
        "5348d3a9-c096-4074-9083-09e3ca69c8e5",
        "ac561643-c5c5-4cf1-868e-8755a90e6fa3"
    ]
)
Source code in src/pyfabricops/core/domains.py
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
def unassign_domain_workspaces_by_ids(
    domain: str, workspaces: List[str]
) -> None:
    """
    Unassign workspaces from the specified domain by workspace ID.

    Args:
        domain (str): The name or ID of the domain to unassign all workspaces.
        workspaces (List[str]): A list of workspace IDs to unassign from the domain.

    Returns:
        None.

    Fabric Rest API Reference:
        https://learn.microsoft.com/en-us/rest/api/fabric/admin/domains/unassign-domain-workspaces-by-ids

    Examples:
        ```python
        unassign_domain_workspaces_by_ids(
            '98f6b7c8-1234-5678-90ab-cdef12345678',
            [
                "e8de1852-7382-480a-8404-d5b1f5e1ab65",
                "5348d3a9-c096-4074-9083-09e3ca69c8e5",
                "ac561643-c5c5-4cf1-868e-8755a90e6fa3"
            ]
        )

        ```
    """
    payload = {'workspaceIds': workspaces}
    return api_request(
        '/admin/domains/' + resolve_domain(domain) + '/unassignWorkspaces',
        method='post',
        payload=payload,
    )

update_domain(domain, *, display_name=None, description=None, df=True)

Update a existing domain.

Parameters:

Name Type Description Default
domain str

The name or id of the current domain.

required
display_name str

The new name of the domain to update.

None
description str

The new description of the domain to update.

None
df Optional[bool]

If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries.

True

Returns:

Type Description
Union[DataFrame, Dict[str, Any], None]

The updated domain details if successful, otherwise None.

Examples:

update_domain(
    domain_id='98f6b7c8-1234-5678-90ab-cdef12345678',
    display_name='NewdomainName',
)
Source code in src/pyfabricops/core/domains.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
@df
def update_domain(
    domain: str,
    *,
    display_name: str = None,
    description: str = None,
    df: Optional[bool] = True,
) -> Union[DataFrame, Dict[str, Any], None]:
    """
    Update a existing domain.

    Args:
        domain (str): The name or id of the current domain.
        display_name (str): The new name of the domain to update.
        description (str): The new description of the domain to update.
        df (Optional[bool]): If True or not provided, returns a DataFrame with flattened keys.
            If False, returns a list of dictionaries.

    Returns:
        (Union[DataFrame, Dict[str, Any], None]): The updated domain details if successful, otherwise None.

    Examples:
        ```python
        update_domain(
            domain_id='98f6b7c8-1234-5678-90ab-cdef12345678',
            display_name='NewdomainName',
        )
        ```
    """
    payload = {}

    if display_name:
        payload = {'displayName': display_name}
    if description:
        payload['description'] = description

    return api_request(
        '/admin/domains/' + resolve_domain(domain),
        payload=payload,
        method='patch',
    )