Question 31
Domain 4: Deploy and operationalize machine learning solutionsYou need to reference a component stored in a YAML file when building a pipeline in Azure ML SDK v2. Which method should you use?
Correct answer: B
Explanation
Azure ML SDK v2 uses the component-loading API to read a component definition from a YAML file. The method `load_component(source='component.yml')` matches that purpose because it loads the component from the specified YAML source so it can be referenced in the pipeline.
Why each option is right or wrong
A. ml_client.load_yaml_component()
B. load_component(source='component.yml')
Azure Machine Learning SDK v2 exposes component definitions through the `azure.ai.ml.load_component` helper, which is the documented API for reading a component spec from a YAML file and returning a reusable component object. In a pipeline, that object is what you reference after loading the YAML source; the `source` parameter points directly to the file path, so `load_component(source='component.yml')` is the correct call for a component stored in YAML.
C. mlflow.load_component()
D. register_component(source='component.yml')