Bharath Kumar L
Bharath Kumar L

Reputation: 118

How to pass environment variables for a AzureML pipeline job using python sdk v2?

I am following the example from this link: https://github.com/Azure/azureml-examples/blob/main/sdk/python/jobs/pipelines/1a_pipeline_with_components_from_yaml/pipeline_with_components_from_yaml.ipynb

I am not sure how to pass the environment variables to the pipeline and use it inside the script that has the execution logic.

Upvotes: 0

Views: 149

Answers (1)

Kavinraja D
Kavinraja D

Reputation: 1

To pass environment variables in an Azure ML pipeline, you can define them in the component.yaml file under the environment section. Once the variables are defined, you can access the script using os module. component.yaml: environment: - MY_ENV_VAR: value scritp: import os my_var = os.getenv('MY_ENV_VAR')

Upvotes: 0

Related Questions