Skip to content

Commit 5219ad3

Browse files
authored
Merge pull request microsoft#73 from denniseik/master
Including Azure ML compute with existing examples. Adding network-isolated examples.
2 parents 4223ffb + 2f2199f commit 5219ad3

File tree

20 files changed

+1008
-215
lines changed

20 files changed

+1008
-215
lines changed

.gitignore

Whitespace-only changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Generate random string for unique compute instance name
2+
resource "random_string" "ci_prefix" {
3+
length = 8
4+
upper = false
5+
special = false
6+
number = false
7+
}
8+
9+
# Compute instance
10+
resource "azurerm_machine_learning_compute_instance" "compute_instance" {
11+
name = "${random_string.ci_prefix.result}instance"
12+
location = azurerm_resource_group.default.location
13+
machine_learning_workspace_id = azurerm_machine_learning_workspace.default.id
14+
virtual_machine_size = "STANDARD_DS2_V2"
15+
}
16+
17+
# Compute Cluster
18+
resource "azurerm_machine_learning_compute_cluster" "compute" {
19+
name = "cpu-cluster"
20+
location = azurerm_resource_group.default.location
21+
machine_learning_workspace_id = azurerm_machine_learning_workspace.default.id
22+
vm_priority = "Dedicated"
23+
vm_size = "STANDARD_DS2_V2"
24+
25+
identity {
26+
type = "SystemAssigned"
27+
}
28+
29+
scale_settings {
30+
min_node_count = 0
31+
max_node_count = 3
32+
scale_down_nodes_after_idle_duration = "PT15M" # 15 minutes
33+
}
34+
35+
}

quickstart/101-machine-learning/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
azurerm = {
66
source = "hashicorp/azurerm"
7-
version = "=2.56.0"
7+
version = "=2.76.0"
88
}
99
}
1010
}
Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
1-
# Azure Machine Learning workspace
1+
# Azure Machine Learning workspace (public network connectivity)
22

33
This deployment configuration specifies an [Azure Machine Learning workspace](https://docs.microsoft.com/en-us/azure/machine-learning/concept-workspace),
44
and its associated resources including Azure Key Vault, Azure Storage, Azure Application Insights and Azure Container Registry.
55

66
This configuration describes the minimal set of resources you require to get started with Azure Machine Learning.
77

8+
Network connectivity to the workspace is allowed over public endpoints, making this configuration suitable for open source projects or pilot environments.
9+
810
## Resources
911

1012
| Terraform Resource Type | Description |
1113
| - | - |
12-
| `azurerm_resource_group` | The resource group all resources get deployed into |
13-
| `azurerm_application_insights` | An Azure Application Insights instance associated to the Azure Machine Learning workspace |
14-
| `azurerm_key_vault` | An Azure Key Vault instance associated to the Azure Machine Learning workspace |
15-
| `azurerm_storage_account` | An Azure Storage instance associated to the Azure Machine Learning workspace |
16-
| `azurerm_container_registry` | An Azure Container Registry instance associated to the Azure Machine Learning workspace |
17-
| `azurerm_machine_learning_workspace` | An Azure Machine Learning workspace instance |
14+
| `azurerm_resource_group` | The resource group all resources get deployed into. |
15+
| `azurerm_application_insights` | An Azure Application Insights instance associated to the Azure Machine Learning workspace. |
16+
| `azurerm_key_vault` | An Azure Key Vault instance associated to the Azure Machine Learning workspace. |
17+
| `azurerm_storage_account` | An Azure Storage instance associated to the Azure Machine Learning workspace. |
18+
| `azurerm_container_registry` | An Azure Container Registry instance associated to the Azure Machine Learning workspace. |
19+
| `azurerm_machine_learning_workspace` | An Azure Machine Learning workspace instance. |
20+
| `azurerm_machine_learning_compute_instance` | An Azure Machine Learning compute instance a single-node managed compute. |
21+
| `azurerm_machine_learning_compute_cluster` | An Azure Machine Learning compute cluster as multi-node shared and managed compute. |
1822

1923
## Variables
2024

21-
| Name | Description |
22-
|-|-|
23-
| name | Name of the deployment |
24-
| environment | The deployment environment name (used for pre- and postfixing resource names) |
25-
| location | The Azure region used for deployments |
25+
| Name | Description | Default |
26+
|-|-|-|
27+
| name | Name of the deployment | - |
28+
| environment | The deployment environment name (used for pre- and postfixing resource names) | dev |
29+
| location | The Azure region used for deployments | East US |
2630

2731
## Usage
2832

2933
```bash
34+
terraform init
35+
3036
terraform plan -var name=azureml567 -out demo.tfplan
3137

3238
terraform apply "demo.tfplan"
3339
```
40+
41+
## Learn more
42+
43+
- If you are new to Azure Machine Learning, see [Azure Machine Learning service](https://azure.microsoft.com/services/machine-learning-service/) and [Azure Machine Learning documentation](https://docs.microsoft.com/azure/machine-learning/).
44+
- To learn more about security configurations in Azure Machine Learning, see [Enterprise security and governance for Azure Machine Learning](https://docs.microsoft.com/en-us/azure/machine-learning/concept-enterprise-security).
45+
- For all configurations of Azure Machine Learning in Terraform, see [Terraform Hashicorp AzureRM provider documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/machine_learning_workspace).

quickstart/101-machine-learning/workspace.tf

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ resource "azurerm_key_vault" "default" {
1313
tenant_id = data.azurerm_client_config.current.tenant_id
1414
sku_name = "premium"
1515
purge_protection_enabled = false
16-
17-
network_acls {
18-
default_action = "Deny"
19-
bypass = "AzureServices"
20-
}
2116
}
2217

2318
resource "azurerm_storage_account" "default" {
@@ -26,19 +21,14 @@ resource "azurerm_storage_account" "default" {
2621
resource_group_name = azurerm_resource_group.default.name
2722
account_tier = "Standard"
2823
account_replication_type = "GRS"
29-
30-
network_rules {
31-
default_action = "Deny"
32-
bypass = ["AzureServices"]
33-
}
3424
}
3525

3626
resource "azurerm_container_registry" "default" {
37-
name = "cr${var.name}${var.environment}"
38-
location = azurerm_resource_group.default.location
39-
resource_group_name = azurerm_resource_group.default.name
40-
sku = "Premium"
41-
admin_enabled = true
27+
name = "cr${var.name}${var.environment}"
28+
location = azurerm_resource_group.default.location
29+
resource_group_name = azurerm_resource_group.default.name
30+
sku = "Premium"
31+
admin_enabled = true
4232
}
4333

4434
# Machine Learning workspace
@@ -54,4 +44,6 @@ resource "azurerm_machine_learning_workspace" "default" {
5444
identity {
5545
type = "SystemAssigned"
5646
}
57-
}
47+
}
48+
49+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generate random string for unique compute instance name
2+
resource "random_string" "ci_prefix" {
3+
length = 8
4+
upper = false
5+
special = false
6+
number = false
7+
}
8+
9+
# Compute instance
10+
resource "azurerm_machine_learning_compute_instance" "compute_instance" {
11+
name = "${random_string.ci_prefix.result}instance"
12+
location = azurerm_resource_group.default.location
13+
machine_learning_workspace_id = azurerm_machine_learning_workspace.default.id
14+
virtual_machine_size = "STANDARD_DS2_V2"
15+
subnet_resource_id = azurerm_subnet.snet-training.id
16+
17+
depends_on = [
18+
azurerm_private_endpoint.mlw_ple
19+
]
20+
}
21+
22+
# Compute cluster
23+
resource "azurerm_machine_learning_compute_cluster" "compute" {
24+
name = "cpu-cluster"
25+
location = azurerm_resource_group.default.location
26+
machine_learning_workspace_id = azurerm_machine_learning_workspace.default.id
27+
vm_priority = "Dedicated"
28+
vm_size = "STANDARD_DS2_V2"
29+
subnet_resource_id = azurerm_subnet.snet-training.id
30+
31+
identity {
32+
type = "SystemAssigned"
33+
}
34+
35+
scale_settings {
36+
min_node_count = 0
37+
max_node_count = 3
38+
scale_down_nodes_after_idle_duration = "PT15M" # 15 minutes
39+
}
40+
41+
}

quickstart/201-machine-learning-private/main.tf renamed to quickstart/201-machine-learning-moderately-secure/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
azurerm = {
66
source = "hashicorp/azurerm"
7-
version = "=2.72.0"
7+
version = "=2.78.0"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)