Skip to content

How to provide environment variables to command components (SDK V2) #44187

@extremilio

Description

@extremilio

Hey!

We're migrating from SDK V1 to V2.
I have to say it's been a headache.

We use yaml command components to run/deploy our scripts with SDK v2.
The yaml command components are loaded into a pipeline_component, and then the pipeline_component runs in a job, using the Python V2 SDK.
The above works, the job and its components execute.

But, how do we set environment variables for these (yaml) components so that they are reachable at runtime?
Can we set it in the command component yaml? In the loaded component? In the pipeline? In the Environment? I've searched and tried almost everything by now, but to no avail.

There's even a forum question about it, where the mods are suggesting the commandComponent.schema.json supports it, which it doesn't:
https://learn.microsoft.com/en-us/answers/questions/2237919/how-to-pass-environment-variable-into-azureml-comp?comment=answer-2015022&page=1#comment-2360727

Side comment is that a lot of the documentaton on SDK V2 references the mldesigner package, which has dependencies to SDK v1 (azureml.core) - and from what I gather this is contraproductive since SDK v1 is out or support next summer? And not even supporting above Python 3.9?
At least when I've tried to use mldesigner, I get errors that I need to add azureml.core as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions