0

I am deploying my machine learning model to an azure container instance through a pipeline using the code snipplet below:

from azureml.core.webservice import AciWebservice

deployment_config = AciWebservice.deploy_configuration(
    cpu_cores=0.5, memory_gb=1, auth_enabled=True
)

And the problem is that I have a secret environment which i want to use in score.py but since I cannot pass this value or cannot set an environment variable, i am unable to use it.

How to overcome this issue?

kuti
  • 21
  • 3

1 Answers1

0

Does this help you? Setup the variable during the container creation :

az container create `
  --resource-group <resource group>`
  --name <name> `
  --image <image> `
  --os-type <os type> `
  --environment-variables public_1="public_2" `
  --secure-environment-variables secret_1="secret_1"

From the docs (https://learn.microsoft.com/en-us/python/api/overview/azure/containerinstance?view=azure-python)

container = Container(name=container_group_name,
                          image=container_image_name,
                          resources=container_resource_requirements,
                          command=start_command_line.split(),
                          environment_variables=[env_var_1, env_var_2])
RubbleFord
  • 7,456
  • 9
  • 50
  • 80
  • Actually does not because I am creating an instanse through Python SDK and it is creating the container automatically. – kuti Aug 09 '21 at 12:37
  • 1
    You could switch to the technique above and run via azure CLI. – RubbleFord Aug 09 '21 at 12:39
  • Switching to this configuration is going to make things difficult for me because I already set up everything in the Python SDK configuration. If is there any way with the current method i am using i would be very grateful – kuti Aug 09 '21 at 12:46
  • https://learn.microsoft.com/en-us/python/api/overview/azure/containerinstance?view=azure-python - Part way down in this document it mentions environment vars. ``` container = Container(name=container_group_name, image=container_image_name, resources=container_resource_requirements, command=start_command_line.split(), environment_variables=[env_var_1, env_var_2]) ``` – RubbleFord Aug 09 '21 at 12:54