Skip to content

Commit

Permalink
Unique Base Name (#60)
Browse files Browse the repository at this point in the history
Have a unique base name ENV var to avoid Azure resource naming conflicts.
  • Loading branch information
eedorenko authored and dtzar committed Sep 4, 2019
1 parent 6156c10 commit 97505df
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion environment_setup/iac-create-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion environment_setup/iac-remove-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
4 changes: 2 additions & 2 deletions ml_service/pipelines/build_train_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions ml_service/util/create_scoring_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions ml_service/util/register_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/code_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 97505df

Please sign in to comment.