1. Managed Identities for AI Services using Azure AD Groups

    Python

    Managed Identities in Azure are a feature of Azure Active Directory (Azure AD) that provide Azure services with an automatically managed identity in Azure AD. You can use this identity to authenticate to any service that supports Azure AD authentication without needing credentials in your code.

    To use Managed Identities for AI Services with Azure AD Groups, you would typically need to create an Azure AD group, assign the managed identity to the group, and then configure your AI service to use the identity of this group for authentication.

    Here's how you can achieve this using Pulumi in Python:

    import pulumi import pulumi_azure_native as azure_native # Create a new Resource Group resource_group = azure_native.resources.ResourceGroup("resourceGroup") # Create an Azure Active Directory Group for AI services ai_services_group = azure_native.authorization.ActiveDirectoryGroup("aiServicesGroup", display_name="AI Services Group", mail_enabled=False, security_enabled=True, group_types=["Unified"]) # Create a User Assigned Managed Identity managed_identity = azure_native.managedidentity.UserAssignedIdentity("aiServiceIdentity", resource_group_name=resource_group.name, location=resource_group.location) # Here we are assigning the Managed Identity to the Azure AD Group. # Currently, Pulumi does not support directly adding a Managed Identity to an AD Group in this manner. # Normally, you would adjust permissions and roles within the Azure Portal or use Azure CLI/PowerShell scripts. # Once managed identity and group are set, you'd configure your Azure AI Service to use this identity. # The AI Service setup will vary based on which AI service you are setting up (e.g., Azure Cognitive Services, Azure Machine Learning, etc.). pulumi.export('resource_group_name', resource_group.name) pulumi.export('ai_services_group_name', ai_services_group.display_name) pulumi.export('managed_identity_id', managed_identity.id)

    In this Pulumi program, we are creating a resource group, an Azure AD group, and a user-assigned managed identity. The managed identity can then be associated with Azure AI services that your application is using.

    • Resource Group (ResourceGroup): This is a logical container for Azure resources. All resources must be in a resource group.
    • Azure AD Group (ActiveDirectoryGroup): We create a group that can be used to manage access for a collection of users.
    • Managed Identity (UserAssignedIdentity): This is the identity that will be used by the AI services. User-assigned managed identities are created as a standalone Azure resource.

    Please note that while Pulumi allows for the creation of these resources, the direct assignment of the managed identity to an AD group and its association with AI services is something typically done outside of Pulumi.

    After creating these resources, you would configure the AI services you're using (like Azure Cognitive Services or Azure Machine Learning) within the Azure Portal or using Azure CLI/PowerShell to utilize the managed identity for authentication. The exact steps for this will depend on the specific AI service you are using. This usually involves configuring the AI service with the identity ID and/or assigning the appropriate role to the managed identity so it can work with the service.