This is an Azure Verified Module that provisions an Azure Machine Learning Workspace, which is a core resource for developing, training, and deploying machine learning models on Azure. Additionally, by setting the kind variable to Hub, this module can also provision an Azure AI Hub, which is an enhanced experience built on top of the Azure Machine Learning Workspace specifically for Generative AI use cases. Finally, if the kind variable is set to Project, this module can provision an AI Project for a Hub.
- Azure Machine Learning Workspace: The default behavior of this module is to create an Azure Machine Learning Workspace, which provides the environment and tools necessary for machine learning tasks.
- Azure AI Hub: If the
kindvariable is set toHub, the module provisions an Azure AI Hub instead, offering additional AI capabilities while still leveraging the underlying Azure Machine Learning infrastructure.
This will create a publicly-accessible Azure Machine Learning Workspace.
module "ml_workspace" {
source = "Azure/avm-res-machinelearningservices-workspace/azurerm"
version = "x.x.x"
location = "<your_location>"
name = "<workspace_name>"
resource_group_name = "<resource_group_name>"
kind = "Default" # Omitting this parameter will result in the same outcome
application_insights = {
resource_id = "<app_insights_resource_id>"
}
container_registry = {
resource_id = azurerm_container_registry.example.id
}
key_vault = {
resource_id = "<key_vault_resource_id>"
}
managed_identities = {
system_assigned = true
}
public_network_access_enabled = true
storage_account = {
resource_id = "<storage_account_resource_id>"
}
workspace_managed_network = {
isolation_mode = "Disabled"
spark_ready = true
}
}This will create a publicly-accessible AI Hub.
module "hub" {
source = "Azure/avm-res-machinelearningservices-workspace/azurerm"
version = "x.x.x"
location = "<your_location>"
name = "<hub_name>"
resource_group_name = "<resource_group_name>"
kind = "Hub"
workspace_managed_network = {
isolation_mode = "Disabled"
spark_ready = true
}
storage_account = {
resource_id = "<storage_account_resource_id>"
}
key_vault = {
resource_id = "<key_vault_resource_id>"
}
}The following requirements are needed by this module:
-
terraform (>= 1.9, < 2.0)
-
azapi (~> 2.6)
-
azurerm (>= 4.17.0, < 5.0)
-
modtm (~> 0.3)
-
random (>= 3.5.0, < 4.0)
The following resources are used by this module:
- azapi_resource.hub (resource)
- azapi_resource.project (resource)
- azapi_resource.this (resource)
- azurerm_management_lock.this (resource)
- azurerm_monitor_diagnostic_setting.this (resource)
- azurerm_private_endpoint.this (resource)
- azurerm_private_endpoint.this_unmanaged_dns_zone_groups (resource)
- azurerm_private_endpoint_application_security_group_association.this (resource)
- azurerm_role_assignment.this (resource)
- modtm_telemetry.telemetry (resource)
- random_uuid.telemetry (resource)
- azapi_client_config.telemetry (data source)
- azurerm_key_vault_key.cmk (data source)
- azurerm_resource_group.current (data source)
- modtm_module_source.telemetry (data source)
The following input variables are required:
Description: Azure region where the resource should be deployed.
Type: string
Description: The name of the this resource.
Type: string
Description: The resource group where the resources will be deployed.
Type: string
The following input variables are optional (have default values):
Description: An object describing the Application Insights resource. This includes the following properties:
resource_id- (Optional) The resource ID of an Application Insights resource.
Type:
object({
resource_id = optional(string)
})Default:
{
"resource_id": null
}Description: An object describing the Azure AI Hub resource for which to create a Project. This includes the following properties:
resource_id- (Optional) The resource ID for an Azure AI Hub
Type:
object({
resource_id = optional(string)
})Default:
{
"resource_id": null
}Description: An object describing the Container Registry. This includes the following properties:
resource_id- The resource ID of an existing Container Registry, if desired.
Type:
object({
resource_id = optional(string)
})Default:
{
"resource_id": null
}Description: A map describing customer-managed keys to associate with the resource. This includes the following properties:
key_vault_resource_id- The resource ID of the Key Vault where the key is stored.key_name- The name of the key.key_version- (Optional) The version of the key. If not specified, the latest version is used.user_assigned_identity- (Optional) An object representing a user-assigned identity with the following properties:resource_id- The resource ID of the user-assigned identity.
Type:
object({
key_vault_resource_id = string
key_name = string
key_version = optional(string, null)
user_assigned_identity = optional(object({
resource_id = string
}), null)
})Default: null
Description: A map of diagnostic settings to create on the Azure Machine Learning Workspace. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
name- (Optional) The name of the diagnostic setting. One will be generated if not set, however this will not be unique if you want to create multiple diagnostic setting resources.log_categories- (Optional) A set of log categories to send to the log analytics workspace. Defaults to[].log_groups- (Optional) A set of log groups to send to the log analytics workspace. Defaults to["allLogs"].metric_categories- (Optional) A set of metric categories to send to the log analytics workspace. Defaults to["AllMetrics"].log_analytics_destination_type- (Optional) The destination type for the diagnostic setting. Possible values areDedicatedandAzureDiagnostics. Defaults toDedicated.workspace_resource_id- (Optional) The resource ID of the log analytics workspace to send logs and metrics to.storage_account_resource_id- (Optional) The resource ID of the storage account to send logs and metrics to.event_hub_authorization_rule_resource_id- (Optional) The resource ID of the event hub authorization rule to send logs and metrics to.event_hub_name- (Optional) The name of the event hub. If none is specified, the default event hub will be selected.marketplace_partner_resource_id- (Optional) The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic LogsLogs.
Type:
map(object({
name = optional(string, null)
log_categories = optional(set(string), [])
log_groups = optional(set(string), ["allLogs"])
metric_categories = optional(set(string), ["AllMetrics"])
log_analytics_destination_type = optional(string, "Dedicated")
workspace_resource_id = optional(string, null)
storage_account_resource_id = optional(string, null)
event_hub_authorization_rule_resource_id = optional(string, null)
event_hub_name = optional(string, null)
marketplace_partner_resource_id = optional(string, null)
}))Default: {}
Description: This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetryinfo.
If it is set to false, then no telemetry will be collected.
Type: bool
Default: true
Description: Specifies if the resource is a High Business Impact (HBI) workspace.
Type: bool
Default: false
Description: The name of the compute resource to use for image building. If not specified, the default compute will be used.
Type: string
Default: null
Description: The list of IPv4 addresses that are allowed to access the workspace.
Type: set(string)
Default: []
Description: DEPRECATED. Please use var.public_network_access_enabled.
Type: bool
Default: null
Description: An object describing the Key Vault required for the workspace. This includes the following properties:
resource_id- The resource ID of an existing Key Vault.use_microsoft_managed_key_vault- A flag indicating if a microsoft managed key value should be used, no new key vault will be created (preview), flag only applicable to AI Hub.
Type:
object({
resource_id = optional(string)
use_microsoft_managed_key_vault = optional(bool, false)
})Default:
{
"resource_id": null
}Description: The kind of the resource. This is used to determine the type of the resource. If not specified, the resource will be created as a standard resource.
Possible values are:
Default- The resource will be created as a standard Azure Machine Learning resource.Hub- The resource will be created as an AI Hub resource.Project- The resource will be created as an AI Studio Project resource.
Type: string
Default: "Default"
Description: Controls the Resource Lock configuration for this resource. The following properties can be specified:
kind- (Required) The type of lock. Possible values are\"CanNotDelete\"and\"ReadOnly\".name- (Optional) The name of the lock. If not specified, a name will be generated based on thekindvalue. Changing this forces the creation of a new resource.
Type:
object({
kind = string
name = optional(string, null)
})Default: null
Description: Controls the Managed Identity configuration on this resource. The following properties can be specified:
system_assigned- (Optional) Specifies if the System Assigned Managed Identity should be enabled.user_assigned_resource_ids- (Optional) Specifies a list of User Assigned Managed Identity resource IDs to be assigned to this resource.
Type:
object({
system_assigned = optional(bool, false)
user_assigned_resource_ids = optional(set(string), [])
})Default: {}
Description: DEPRECATED. Please use var.workspace_managed_network.outbound_rules.private_endpoint instead. It will be removed completely in a later release.
A map of private endpoints outbound rules for the managed network.
resource_id- The resource id for the corresponding private endpoint.sub_resource_target- The sub_resource_target is target for the private endpoint. e.g. account for Openai, searchService for Azure Ai Search
Type:
map(object({
resource_id = string
sub_resource_target = string
}))Default: {}
Description: The resource id of the primary user-assigned managed identity for the workspace.
Type:
object({
resource_id = optional(string, null)
})Default: {}
Description: A map of private endpoints to create on the Key Vault. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
name- (Optional) The name of the private endpoint. One will be generated if not set.role_assignments- (Optional) A map of role assignments to create on the private endpoint. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time. Seevar.role_assignmentsfor more information.role_definition_id_or_name- The ID or name of the role definition to assign to the principal.principal_id- The ID of the principal to assign the role to.description- (Optional) The description of the role assignment.skip_service_principal_aad_check- (Optional) If set to true, skips the Azure Active Directory check for the service principal in the tenant. Defaults to false.condition- (Optional) The condition which will be used to scope the role assignment.condition_version- (Optional) The version of the condition syntax. Leave asnullif you are not using a condition, if you are then valid values are '2.0'.delegated_managed_identity_resource_id- (Optional) The delegated Azure Resource Id which contains a Managed Identity. Changing this forces a new resource to be created. This field is only used in cross-tenant scenario.principal_type- (Optional) The type of theprincipal_id. Possible values areUser,GroupandServicePrincipal. It is necessary to explicitly set this attribute when creating role assignments if the principal creating the assignment is constrained by ABAC rules that filters on the PrincipalType attribute.
lock- (Optional) The lock level to apply to the private endpoint. Default isNone. Possible values areNone,CanNotDelete, andReadOnly.kind- (Required) The type of lock. Possible values are\"CanNotDelete\"and\"ReadOnly\".name- (Optional) The name of the lock. If not specified, a name will be generated based on thekindvalue. Changing this forces the creation of a new resource.
tags- (Optional) A mapping of tags to assign to the private endpoint.subnet_resource_id- The resource ID of the subnet to deploy the private endpoint in.private_dns_zone_group_name- (Optional) The name of the private DNS zone group. One will be generated if not set.private_dns_zone_resource_ids- (Optional) A set of resource IDs of private DNS zones to associate with the private endpoint. If not set, no zone groups will be created and the private endpoint will not be associated with any private DNS zones. DNS records must be managed external to this module.application_security_group_resource_ids- (Optional) A map of resource IDs of application security groups to associate with the private endpoint. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.private_service_connection_name- (Optional) The name of the private service connection. One will be generated if not set.network_interface_name- (Optional) The name of the network interface. One will be generated if not set.location- (Optional) The Azure location where the resources will be deployed. Defaults to the location of the resource group.resource_group_name- (Optional) The resource group where the resources will be deployed. Defaults to the resource group of the Key Vault.ip_configurations- (Optional) A map of IP configurations to create on the private endpoint. If not specified the platform will create one. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.name- The name of the IP configuration.private_ip_address- The private IP address of the IP configuration.
Type:
map(object({
name = optional(string, null)
role_assignments = optional(map(object({
role_definition_id_or_name = string
principal_id = string
description = optional(string, null)
skip_service_principal_aad_check = optional(bool, false)
condition = optional(string, null)
condition_version = optional(string, null)
delegated_managed_identity_resource_id = optional(string, null)
principal_type = optional(string, null)
})), {})
lock = optional(object({
kind = string
name = optional(string, null)
}), null)
tags = optional(map(string), null)
subnet_resource_id = string
#subresource_name = string # NOTE: `subresource_name` can be excluded if the resource does not support multiple sub resource types (e.g. storage account supports blob, queue, etc)
private_dns_zone_group_name = optional(string, "default")
private_dns_zone_resource_ids = optional(set(string), [])
application_security_group_associations = optional(map(string), {})
private_service_connection_name = optional(string, null)
network_interface_name = optional(string, null)
location = optional(string, null)
resource_group_name = optional(string, null)
ip_configurations = optional(map(object({
name = string
private_ip_address = string
})), {})
}))Default: {}
Description: Whether to manage private DNS zone groups with this module. If set to false, you must manage private DNS zone groups externally, e.g. using Azure Policy.
Type: bool
Default: true
Description: (Optional) Whether (inbound) requests from the Internet / public network are allowed. Default is false
Type: bool
Default: false
Description: A map of role assignments to create on this resource. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
role_definition_id_or_name- The ID or name of the role definition to assign to the principal.principal_id- The ID of the principal to assign the role to.description- (Optional) The description of the role assignment.skip_service_principal_aad_check- (Optional) If set to true, skips the Azure Active Directory check for the service principal in the tenant. Defaults to false.condition- (Optional) The condition which will be used to scope the role assignment.condition_version- (Optional) The version of the condition syntax. Leave asnullif you are not using a condition, if you are then valid values are '2.0'.delegated_managed_identity_resource_id- (Optional) The delegated Azure Resource Id which contains a Managed Identity. Changing this forces a new resource to be created. This field is only used in cross-tenant scenario.principal_type- (Optional) The type of theprincipal_id. Possible values areUser,GroupandServicePrincipal. It is necessary to explicitly set this attribute when creating role assignments if the principal creating the assignment is constrained by ABAC rules that filters on the PrincipalType attribute.
Note: only set
skip_service_principal_aad_checkto true if you are assigning a role to a service principal.
Type:
map(object({
role_definition_id_or_name = string
principal_id = string
description = optional(string, null)
skip_service_principal_aad_check = optional(bool, false)
condition = optional(string, null)
condition_version = optional(string, null)
delegated_managed_identity_resource_id = optional(string, null)
principal_type = optional(string, null)
}))Default: {}
Description: The authentication mode used for accessing the system datastores of the workspace. Valid options include 'accessKey' and 'identity'. **This will be deprecated once the version of ARM used with the azapi provider is updated from 2024-07-01-preview as it was removed from the schema.
Type: string
Default: "identity"
Description: An object describing the Storage Account for the workspace. This includes the following properties:
resource_id- The resource ID of an existing Storage Account.
Type:
object({
resource_id = optional(string)
})Default:
{
"resource_id": null
}Description: (Optional) Tags of the resource.
Type: map(string)
Default: null
Description: The description of this workspace.
Type: string
Default: ""
Description: The friendly name for this workspace. This value in mutable.
Type: string
Default: "Workspace"
Description: Specifies properties of the workspace's managed virtual network.
isolation_mode: While is possible to update the workspace to enable network isolation (going from 'Disabled' to 'AllowInternetOutbound' or 'AllowOnlyApprovedOutbound'), it is not possible to disable it on a workspace with it enabled.- 'Disabled': Inbound and outbound traffic is unrestricted or BYO VNet to protect resources.
- 'AllowInternetOutbound': Allow all internet outbound traffic.
- 'AllowOnlyApprovedOutbound': Outbound traffic is allowed by specifying service tags.
spark_readydetermines whether spark jobs will be run on the network. This value can be updated in the future.outbound_rules:fqdn: A map of FQDN rules. Only valid whenisolation_modeis 'AllowOnlyApprovedOutbound'. **The inclusion of FQDN rules requires Azure Firewall to be deployed and used and cost will increase accordingly.destination: The allowed host name. Required. Examples: '.anaconda.com' to install packages, 'pypi.org' to list dependencies, '.tensorflow.org' for use with TensorFlow examples
private_endpoint: A map of Private Endpoint rules.resource_id: The id of the resource with the private endpoint to enable the workspace to communicate with. Required.sub_resource_target: The specific target endpoint for the resource. Some Azure resources have only 1 option, while others will expose multiple. Required.spark_enabled: Whether to the endpoint should be Spark-enabled. This is primarily set 'true' if, and only if,spark_readyis true.
service_tag: A map of Service Tag rules. Only valid whenisolation_modeis 'AllowOnlyApprovedOutbound'.action: The networking rule to apply. Available options are 'Allow' or 'Deny'.service_tag: The target service tag.address_prefixes: Optional collection of address prefixes. If provided,service_tagwill be ignored.protocol: The allowed protocol(s). Valid options dependent on Service Tag.port_ranges: The allow port(s) / port ranges. Valid options dependent on Service Tag.
firewall_sku: The SKU of the Azure Firewall. Valid options are 'Basic' or 'Standard'. Default is 'Standard'.
Type:
object({
isolation_mode = string
spark_ready = optional(bool, true)
outbound_rules = optional(object({
fqdn = optional(map(object({
destination = string
})), {})
private_endpoint = optional(map(object({
resource_id = string
sub_resource_target = string
spark_enabled = optional(bool, false)
})), {})
service_tag = optional(map(object({
action = string
service_tag = string
address_prefixes = optional(list(string), null)
protocol = string
port_ranges = string
})), {})
}), {})
firewall_sku = optional(string, "Standard")
})Default:
{
"firewall_sku": "Standard",
"isolation_mode": "Disabled",
"spark_ready": true
}The following outputs are exported:
Description: DEPRECATED. Will always be null.
Description: DEPRECATED. Will always be null.
Description: A map of the private endpoints created.
Description: DEPRECATED. Use workspace or other outputs instead. If additional fields are required, open a bug. Note: the only input value that should be output too is name
Description: The ID of the machine learning workspace.
Description: The system-assigned managed identity for the created workspace, if applicable.
Description: The machine learning workspace created.
Description: DEPRECATED. Use system_assigned_mi_principal_id instead, if the workspace was configured for system-assigned managed identity.
No modules.
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.