1. Group-based Access Control for Azure ML Workspaces


    Group-based Access Control (RBAC) for Azure Machine Learning (Azure ML) workspaces is a key aspect in ensuring that only authorized users and groups have access to the ML resources and can perform actions according to their roles within your organization.

    To setup group-based access control for Azure ML Workspaces in Pulumi using Python, you will need to configure Role-Based Access Control (RBAC) through Azure Role Assignments. You would assign Azure roles to Azure Active Directory (AD) groups which contain the users that should have access to the ML Workspace.

    Azure ML workspaces are typically managed under the MachineLearningWorkspace resource, but the Pulumi Registry Results did not return an exact match for this resource. However, azure-native.easm.Workspace appears to be a closely related resource. We can use the general azure-native.authorization resources to assign roles. Azure presents a number of built-in roles that can apply to Machine Learning workspaces like "Machine Learning Administrator", "Machine Learning Contributor", and others.

    Let's create a Pulumi program in Python that provisions an Azure ML Workspace and assigns a group access to it using RBAC:

    import pulumi import pulumi_azure_native as azure_native from pulumi_azure_native.authorization import RoleAssignment # Assume an existing Azure AD Group that you want to grant access group_id = "your-ad-group-id" # Provision an Azure ML Workspace # The exact name of the Workspace might differ depending on the Pulumi resource available ml_workspace = azure_native.machinelearningservices.Workspace( "mlWorkspace", resource_group_name="your-resource-group", location="your-location", workspace_name="your-ml-workspace-name", # ... any other required and optional properties ) # Assign the ML Contributor role to the AD group for the ML Workspace # Built-in roles can be used, such as "Machine Learning Contributor" role_definition_id = f"/subscriptions/{azure_native.config.subscription_id}/providers/Microsoft.Authorization/roleDefinitions/your-role-definition-id" ml_workspace_contributor_assignment = RoleAssignment( "mlWorkspaceContributorAssignment", scope=ml_workspace.id, role_definition_id=role_definition_id, principal_id=group_id ) # Export the ML Workspace ID pulumi.export("workspace_id", ml_workspace.id)

    In this program:

    • Import the necessary modules from the Pulumi Azure Native package.
    • Provide an Azure Active Directory Group ID that represents the group you want to grant access to. This should be replaced with an actual group ID from your Azure AD.
    • Create a Machine Learning Workspace within your specified resource_group_name and location.
    • Use the RoleAssignment class from pulumi_azure_native.authorization to assign a role to the group. You'll need to specify the role definition ID for the role you want to assign (e.g., ML Contributor), which can be found in your Azure tenant's subscription.
    • Lastly, export the ID of the workspace to be accessible outside of Pulumi for any other references you might need.

    Please ensure you replace placeholders like your-ad-group-id, your-resource-group, your-location, your-ml-workspace-name, and your-role-definition-id with actual values from your Azure environment.

    The role ID can be found in the Azure portal under Azure Active Directory roles, or by using the Azure CLI or PowerShell to list all role definitions and get the specific ID for the role intended. The role assignment will give the specified AD group the permissions natively defined by Azure for the role, allowing members of that group to interact with the Azure Machine Learning Workspace as per the role's permissions.