diff --git a/docs/getting_started.md b/docs/getting_started.md index 00ae2e6e..068ea84f 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -35,14 +35,12 @@ The variable group should contain the following variables: | --------------------------- | ---------------------------- | | AML_COMPUTE_CLUSTER_CPU_SKU | STANDARD_DS2_V2 | | AML_COMPUTE_CLUSTER_NAME | train-cluster | -| AML_WORKSPACE_NAME | mlops-AML-WS | -| BASE_NAME | mlops | +| BASE_NAME | [unique base name] | | EVALUATE_SCRIPT_PATH | evaluate/evaluate_model.py | | EXPERIMENT_NAME | mlopspython | | LOCATION | centralus | | MODEL_NAME | sklearn_regression_model.pkl | | REGISTER_SCRIPT_PATH | register/register_model.py | -| RESOURCE_GROUP | mlops-AML-RG | | SOURCES_DIR_TRAIN | code | | SP_APP_ID | | | SP_APP_SECRET | | @@ -52,6 +50,8 @@ The variable group should contain the following variables: Mark **SP_APP_SECRET** variable as a secret one. +**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. + Make sure to select the **Allow access to all pipelines** checkbox in the variable group configuration. Up until now you should have: diff --git a/environment_setup/iac-create-environment.yml b/environment_setup/iac-create-environment.yml index 57e5a106..6c2495cb 100644 --- a/environment_setup/iac-create-environment.yml +++ b/environment_setup/iac-create-environment.yml @@ -18,7 +18,7 @@ steps: inputs: azureSubscription: 'AzureResourceConnection' action: 'Create Or Update Resource Group' - resourceGroupName: '$(RESOURCE_GROUP)' + resourceGroupName: '$(BASE_NAME)-AML-RG' location: $(LOCATION) templateLocation: 'Linked artifact' csmFile: '$(Build.SourcesDirectory)/environment_setup/arm-templates/cloud-environment.json' diff --git a/environment_setup/iac-remove-environment.yml b/environment_setup/iac-remove-environment.yml index 67626223..4ca8b04e 100644 --- a/environment_setup/iac-remove-environment.yml +++ b/environment_setup/iac-remove-environment.yml @@ -18,7 +18,7 @@ steps: inputs: azureSubscription: 'AzureResourceConnection' action: 'DeleteRG' - resourceGroupName: '$(RESOURCE_GROUP)' + resourceGroupName: '$(BASE_NAME)-AML-RG' location: $(LOCATION) displayName: 'Delete resources in Azure' diff --git a/ml_service/pipelines/build_train_pipeline.py b/ml_service/pipelines/build_train_pipeline.py index a294a1c0..df5dcdcc 100644 --- a/ml_service/pipelines/build_train_pipeline.py +++ b/ml_service/pipelines/build_train_pipeline.py @@ -15,8 +15,8 @@ def main(): load_dotenv() - workspace_name = os.environ.get("AML_WORKSPACE_NAME") - resource_group = os.environ.get("RESOURCE_GROUP") + workspace_name = os.environ.get("BASE_NAME")+"-AML-WS" + resource_group = os.environ.get("BASE_NAME")+"-AML-RG" subscription_id = os.environ.get("SUBSCRIPTION_ID") tenant_id = os.environ.get("TENANT_ID") app_id = os.environ.get("SP_APP_ID") diff --git a/ml_service/util/create_scoring_image.py b/ml_service/util/create_scoring_image.py index 8461fb45..08ae49b5 100644 --- a/ml_service/util/create_scoring_image.py +++ b/ml_service/util/create_scoring_image.py @@ -8,11 +8,11 @@ load_dotenv() TENANT_ID = os.environ.get('TENANT_ID') -APP_ID = os.environ.get('APP_ID') -APP_SECRET = os.environ.get('APP_SECRET') -WORKSPACE_NAME = os.environ.get('WORKSPACE_NAME') +APP_ID = os.environ.get('SP_APP_ID') +APP_SECRET = os.environ.get('SP_APP_SECRET') +WORKSPACE_NAME = os.environ.get("BASE_NAME")+"-AML-WS" SUBSCRIPTION_ID = os.environ.get('SUBSCRIPTION_ID') -RESOURCE_GROUP = os.environ.get('RESOURCE_GROUP') +RESOURCE_GROUP = os.environ.get("BASE_NAME")+"-AML-RG" MODEL_NAME = os.environ.get('MODEL_NAME') MODEL_VERSION = os.environ.get('MODEL_VERSION') IMAGE_NAME = os.environ.get('IMAGE_NAME') diff --git a/ml_service/util/register_model.py b/ml_service/util/register_model.py index 6f9634ab..ea26a997 100644 --- a/ml_service/util/register_model.py +++ b/ml_service/util/register_model.py @@ -11,13 +11,13 @@ load_dotenv() TENANT_ID = os.environ.get('TENANT_ID') -APP_ID = os.environ.get('APP_ID') -APP_SECRET = os.environ.get('APP_SECRET') +APP_ID = os.environ.get('SP_APP_ID') +APP_SECRET = os.environ.get('SP_APP_SECRET') MODEL_PATH = os.environ.get('MODEL_PATH') MODEL_NAME = os.environ.get('MODEL_NAME') -WORKSPACE_NAME = os.environ.get('WORKSPACE_NAME') +WORKSPACE_NAME = os.environ.get("BASE_NAME")+"-AML-WS" SUBSCRIPTION_ID = os.environ.get('SUBSCRIPTION_ID') -RESOURCE_GROUP = os.environ.get('RESOURCE_GROUP') +RESOURCE_GROUP = os.environ.get("BASE_NAME")+"-AML-RG" if os.path.isfile(MODEL_PATH) is False: diff --git a/tests/unit/code_test.py b/tests/unit/code_test.py index bcdf5e3e..b22b186c 100644 --- a/tests/unit/code_test.py +++ b/tests/unit/code_test.py @@ -7,8 +7,8 @@ # Just an example of a unit test against # a utility function common_scoring.next_saturday def test_get_workspace(): - workspace_name = os.environ.get("AML_WORKSPACE_NAME") - resource_group = os.environ.get("RESOURCE_GROUP") + workspace_name = os.environ.get("BASE_NAME")+"-AML-WS" + resource_group = os.environ.get("BASE_NAME")+"-AML-RG" subscription_id = os.environ.get("SUBSCRIPTION_ID") tenant_id = os.environ.get("TENANT_ID") app_id = os.environ.get("SP_APP_ID")