Skip to content

Commit 97505df

Browse files
eedorenkodtzar
authored andcommitted
Unique Base Name (#60)
Have a unique base name ENV var to avoid Azure resource naming conflicts.
1 parent 6156c10 commit 97505df

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

docs/getting_started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@ The variable group should contain the following variables:
3535
| --------------------------- | ---------------------------- |
3636
| AML_COMPUTE_CLUSTER_CPU_SKU | STANDARD_DS2_V2 |
3737
| AML_COMPUTE_CLUSTER_NAME | train-cluster |
38-
| AML_WORKSPACE_NAME | mlops-AML-WS |
39-
| BASE_NAME | mlops |
38+
| BASE_NAME | [unique base name] |
4039
| EVALUATE_SCRIPT_PATH | evaluate/evaluate_model.py |
4140
| EXPERIMENT_NAME | mlopspython |
4241
| LOCATION | centralus |
4342
| MODEL_NAME | sklearn_regression_model.pkl |
4443
| REGISTER_SCRIPT_PATH | register/register_model.py |
45-
| RESOURCE_GROUP | mlops-AML-RG |
4644
| SOURCES_DIR_TRAIN | code |
4745
| SP_APP_ID | |
4846
| SP_APP_SECRET | |
@@ -52,6 +50,8 @@ The variable group should contain the following variables:
5250

5351
Mark **SP_APP_SECRET** variable as a secret one.
5452

53+
**Note:** The BASE_NAME parameter is used throughout the solution for naming Azure resources. When the solution is used in a shared subscription, there can be naming collisions with resources that require unique names like azure blob storage and registry DNS naming. Make sure to give a unique value to the BASE_NAME variable (e.g. MyUniqueML), so that the created resources will have unique names (e.g. MyUniqueML-AML-RG, MyUniqueML-AML-WS, etc.). The length of the BASE_NAME value should not exceed 10 characters.
54+
5555
Make sure to select the **Allow access to all pipelines** checkbox in the variable group configuration.
5656

5757
Up until now you should have:

environment_setup/iac-create-environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ steps:
1818
inputs:
1919
azureSubscription: 'AzureResourceConnection'
2020
action: 'Create Or Update Resource Group'
21-
resourceGroupName: '$(RESOURCE_GROUP)'
21+
resourceGroupName: '$(BASE_NAME)-AML-RG'
2222
location: $(LOCATION)
2323
templateLocation: 'Linked artifact'
2424
csmFile: '$(Build.SourcesDirectory)/environment_setup/arm-templates/cloud-environment.json'

environment_setup/iac-remove-environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ steps:
1818
inputs:
1919
azureSubscription: 'AzureResourceConnection'
2020
action: 'DeleteRG'
21-
resourceGroupName: '$(RESOURCE_GROUP)'
21+
resourceGroupName: '$(BASE_NAME)-AML-RG'
2222
location: $(LOCATION)
2323
displayName: 'Delete resources in Azure'
2424

ml_service/pipelines/build_train_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
def main():
1717
load_dotenv()
18-
workspace_name = os.environ.get("AML_WORKSPACE_NAME")
19-
resource_group = os.environ.get("RESOURCE_GROUP")
18+
workspace_name = os.environ.get("BASE_NAME")+"-AML-WS"
19+
resource_group = os.environ.get("BASE_NAME")+"-AML-RG"
2020
subscription_id = os.environ.get("SUBSCRIPTION_ID")
2121
tenant_id = os.environ.get("TENANT_ID")
2222
app_id = os.environ.get("SP_APP_ID")

ml_service/util/create_scoring_image.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
load_dotenv()
99

1010
TENANT_ID = os.environ.get('TENANT_ID')
11-
APP_ID = os.environ.get('APP_ID')
12-
APP_SECRET = os.environ.get('APP_SECRET')
13-
WORKSPACE_NAME = os.environ.get('WORKSPACE_NAME')
11+
APP_ID = os.environ.get('SP_APP_ID')
12+
APP_SECRET = os.environ.get('SP_APP_SECRET')
13+
WORKSPACE_NAME = os.environ.get("BASE_NAME")+"-AML-WS"
1414
SUBSCRIPTION_ID = os.environ.get('SUBSCRIPTION_ID')
15-
RESOURCE_GROUP = os.environ.get('RESOURCE_GROUP')
15+
RESOURCE_GROUP = os.environ.get("BASE_NAME")+"-AML-RG"
1616
MODEL_NAME = os.environ.get('MODEL_NAME')
1717
MODEL_VERSION = os.environ.get('MODEL_VERSION')
1818
IMAGE_NAME = os.environ.get('IMAGE_NAME')

ml_service/util/register_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
load_dotenv()
1212

1313
TENANT_ID = os.environ.get('TENANT_ID')
14-
APP_ID = os.environ.get('APP_ID')
15-
APP_SECRET = os.environ.get('APP_SECRET')
14+
APP_ID = os.environ.get('SP_APP_ID')
15+
APP_SECRET = os.environ.get('SP_APP_SECRET')
1616
MODEL_PATH = os.environ.get('MODEL_PATH')
1717
MODEL_NAME = os.environ.get('MODEL_NAME')
18-
WORKSPACE_NAME = os.environ.get('WORKSPACE_NAME')
18+
WORKSPACE_NAME = os.environ.get("BASE_NAME")+"-AML-WS"
1919
SUBSCRIPTION_ID = os.environ.get('SUBSCRIPTION_ID')
20-
RESOURCE_GROUP = os.environ.get('RESOURCE_GROUP')
20+
RESOURCE_GROUP = os.environ.get("BASE_NAME")+"-AML-RG"
2121

2222

2323
if os.path.isfile(MODEL_PATH) is False:

tests/unit/code_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
# Just an example of a unit test against
88
# a utility function common_scoring.next_saturday
99
def test_get_workspace():
10-
workspace_name = os.environ.get("AML_WORKSPACE_NAME")
11-
resource_group = os.environ.get("RESOURCE_GROUP")
10+
workspace_name = os.environ.get("BASE_NAME")+"-AML-WS"
11+
resource_group = os.environ.get("BASE_NAME")+"-AML-RG"
1212
subscription_id = os.environ.get("SUBSCRIPTION_ID")
1313
tenant_id = os.environ.get("TENANT_ID")
1414
app_id = os.environ.get("SP_APP_ID")

0 commit comments

Comments
 (0)