%pip install semantic-link-labs
import sempy_labs as labs
import sempy_labs.admin as admin
azure_subscription_id = '' # Enter your Azure subscription ID
key_vault_uri = '' # Enter your Azure Key Vault URI
key_vault_tenant_id = '' # Enter the name of the Azure Key Vault secret which stores your Tenant ID
key_vault_client_id = '' # Enter the name of the Azure Key Vault secret which stores your Client ID (Application ID)
key_vault_client_secret = '' # Enter the name of the Azure Key Vault secret which stores your Client Secret
resource_group = '' # Enter the name of the resource group (to be used to create the new F skus)
Set the 'capacities' parameter to the single P SKU.
labs.migrate_capacities(
azure_subscription_id = azure_subscription_id,
key_vault_uri = key_vault_uri,
key_vault_tenant_id = key_vault_tenant_id,
key_vault_client_id = key_vault_client_id,
key_vault_client_secret = key_vault_client_secret,
resource_group = resource_group,
capacities = 'CapacityA',
p_sku_only = True,
)
Set the 'capacities' parameter to a list of P SKUs.
labs.migrate_capacities(
azure_subscription_id = azure_subscription_id,
key_vault_uri = key_vault_uri,
key_vault_tenant_id = key_vault_tenant_id,
key_vault_client_id = key_vault_client_id,
key_vault_client_secret = key_vault_client_secret,
resource_group = resource_group,
capacities = ['CapacityA', 'CapacityB', 'CapacityC'],
p_sku_only = True,
)
Set the 'capacities' parameter to None.
labs.migrate_capacities(
azure_subscription_id = azure_subscription_id,
key_vault_uri = key_vault_uri,
key_vault_tenant_id = key_vault_tenant_id,
key_vault_client_id = key_vault_client_id,
key_vault_client_secret = key_vault_client_secret,
resource_group = resource_group,
capacities = None,
p_sku_only = True,
)
This process ensures that each F SKU is created within the resource group specified in the resource_group_mapping dictionary.
resource_group_mapping = {
"CapacityA": "ResourceGroupA",
"CapacityB": "ResourceGroupA",
"CapacityC": "ResourceGroupB",
}
labs.migrate_capacities(
azure_subscription_id = azure_subscription_id,
key_vault_uri = key_vault_uri,
key_vault_tenant_id = key_vault_tenant_id,
key_vault_client_id = key_vault_client_id,
key_vault_client_secret = key_vault_client_secret,
resource_group = resource_group_mapping,
capacities = ['CapacityA', 'CapacityB', 'CapacityC'],
p_sku_only = True,
)
source_capacity = '' # Enter the Source capacity name
target_capacity = '' # Enter the Target capacity name (already exists)
admin.assign_workspaces_to_capacity(
source_capacity=source_capacity,
target_capacity=target_capacity,
workspace=None,
)
# Optionally migrate settings
"""
labs.migrate_capacity_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_access_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_delegated_tenant_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_disaster_recovery_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_notification_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_spark_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
"""
capacity_mapping = {
"capacitya": "capacityanew", # Format is "Source SKU": "Target SKU"
"capacityb": "capacitybnew",
"capacityc": "capacitycnew",
}
capacities = list(capacity_mapping.keys())
for capacity in capacities:
admin.assign_workspaces_to_capacity(
source_capacity=capacity,
target_capacity=capacity_mapping.get(capacity),
workspace=None,
)
# Optionally migrate settings
"""
labs.migrate_capacity_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_access_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_delegated_tenant_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_disaster_recovery_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_notification_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
labs.migrate_spark_settings(
source_capacity=source_capacity,
target_capacity=target_capacity
)
"""
labs.migrate_fabric_trial_capacity(
azure_subscription_id = azure_subscription_id,
key_vault_uri = key_vault_uri,
key_vault_tenant_id = key_vault_tenant_id,
key_vault_client_id = key_vault_client_id,
key_vault_client_secret = key_vault_client_secret,
resource_group = resource_group,
source_capacity = '', # The name of the Trial capacity.
target_capacity = '', # The name of Fabric capacity (if it does not exist it will be created).
target_capacity_sku = "F64", # Defaults to F64 but can specify the required SKU.
target_capacity_region = None, # Setting this not None will create the Fabric capacity in the same region as the Trial capacity.
target_capacity_admin_members = None, # Setting this to None will use the same admin members as the Trial capacity.
)