Skip to content
Permalink
Browse files

Unique Base Name (#60)

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 97505df4ae4b5dee444ba18a622931b664e72ab8
@@ -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:
@@ -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'
@@ -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'

@@ -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")
@@ -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')
@@ -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:
@@ -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")

0 comments on commit 97505df

Please sign in to comment.
You can’t perform that action at this time.