Skip to content
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

AI hub Storage account access type not set Identity-based access #38536

Open
AjitPadhi-Microsoft opened this issue Nov 14, 2024 · 1 comment
Open
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@AjitPadhi-Microsoft
Copy link

AjitPadhi-Microsoft commented Nov 14, 2024

Describe the bug
We are using below code to create hub with storage account but issue in hub creation. Hub creates with storage account access as Credential-based access instead Identity-based access
`from azure.ai.ml import MLClient
from azure.ai.ml.entities import (
Hub,
Project,
ApiKeyConfiguration,
AzureAISearchConnection,
AzureOpenAIConnection,
IdentityConfiguration,
)
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient
from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.storage.models import (
StorageAccountCreateParameters,
Sku,
Kind,
)

key_vault_name = "kv_to-be-replaced"
subscription_id = "subscription_to-be-replaced"
resource_group_name = "rg_to-be-replaced"
aihub_name = "ai_hub_" + "solutionname_to-be-replaced"
project_name = "ai_project_" + "solutionname_to-be-replaced"
deployment_name = "draftsinference-" + "solutionname_to-be-replaced"
solutionLocation = "solutionlocation_to-be-replaced"
storage_account_name = "storageaihub" + "solutionname_to-be-replaced"

credential = DefaultAzureCredential()
ml_client = MLClient(
workspace_name=aihub_name,
resource_group_name=resource_group_name,
subscription_id=subscription_id,
credential=credential,
)

Create a Storage Management client

storage_client = StorageManagementClient(credential, subscription_id)

Create the storage account if it doesn't exist

storage_account_params = StorageAccountCreateParameters(
sku=Sku(name="Standard_LRS"),
kind=Kind.STORAGE_V2,
location=solutionLocation,
identity={"type": "SystemAssigned"},
allow_shared_key_access=False,
)
storage_account = storage_client.storage_accounts.begin_create(
resource_group_name, storage_account_name, storage_account_params
).result()

Define the Hub with Managed Identity

my_hub = Hub(
name=aihub_name,
location=solutionLocation,
display_name=aihub_name,
storage_account=storage_account.id,
identity=IdentityConfiguration(type="SystemAssigned"),
)

Create the Hub

created_hub = ml_client.workspaces.begin_create(
my_hub, update_dependent_resources=True
).result()

Construct the project

my_project = Project(
name=project_name,
location=solutionLocation,
display_name=project_name,
hub_id=created_hub.id,
)

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

To Reproduce
Steps to reproduce the behavior:

  1. Use the above code to create Hub and storage The hub creates with credential based access

Expected behavior
It should create AI hub and storage account based on identity based access.

Screenshots
Image

Additional context
Add any other context about the problem here.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Nov 14, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jalauzon-msft @vincenttran-msft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

1 participant