Skip to content

fix: Fix for Handling Hub Creation and Validation in Azure ML Client #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Get Azure Key Vault Client
key_vault_name = 'kv_to-be-replaced'

import time
from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
Hub,
Expand Down Expand Up @@ -73,7 +74,10 @@ def get_secrets_from_kv(kv_name, secret_name):
# construct a hub
my_hub = Hub(name=aihub_name, location=solutionLocation, display_name=aihub_name)

created_hub = ml_client.workspaces.begin_create(my_hub).result()
created_hub = ml_client.workspaces.begin_create(my_hub)

time.sleep(60) # wait for hub to be created
created_hub = ml_client.workspaces.get(name=aihub_name)

# construct the project
my_project = Project(
Expand All @@ -83,7 +87,9 @@ def get_secrets_from_kv(kv_name, secret_name):
hub_id=created_hub.id,
)

created_project = ml_client.workspaces.begin_create(workspace=my_project).result()
created_project = ml_client.workspaces.begin_create(workspace=my_project)

time.sleep(30) # wait for hub to be created

open_ai_connection = AzureOpenAIConnection(
name="Azure_OpenAI",
Expand Down