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

Update account_uri when storage_name is updated for AzureBlobstoreAss… #3846

Merged
merged 4 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions scripts/azureml-assets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 1.17.0 (Unreleased)
### 🚀 New Features

## 1.16.72 (2025-02-19)
### 🐛 Bugs Fixed
- [#3846](https://github.com/Azure/azureml-assets/pull/3846) Update account_uri when storage_name is updated for AzureBlobstoreAssetPath

## 1.16.71 (2025-02-12)
### 🐛 Bugs Fixed
Expand Down
10 changes: 7 additions & 3 deletions scripts/azureml-assets/azureml/assets/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,9 @@ def __init__(self, storage_name: str, container_name: str, container_path: str):
if _get_default_cloud_name() in [AzureEnvironments.ENV_DEFAULT,
AzureEnvironments.ENV_US_GOVERNMENT,
AzureEnvironments.ENV_CHINA]:
cloud_suffix = AzureBlobstoreAssetPath.AZURE_CLOUD_SUFFIX
self._cloud_suffix = AzureBlobstoreAssetPath.AZURE_CLOUD_SUFFIX
else:
cloud_suffix = _get_storage_endpoint_from_metadata()
self._account_uri = f"https://{storage_name}.blob.{cloud_suffix}"
self._cloud_suffix = _get_storage_endpoint_from_metadata()

# Its possible that the account URL may need additional tweaking to add a SAS
# token if the account does not allow for anonymous access. However, for
Expand Down Expand Up @@ -680,6 +679,11 @@ def get_file_contents(self, name: str, encoding: str = "UTF-8") -> Union[str, by
file_contents = container_client.download_blob(container_prefix + name, encoding=encoding).readall()
return file_contents

@property
def _account_uri(self) -> str:
"""Account URI."""
return f"https://{self._storage_name}.blob.{self._cloud_suffix}"

@property
def uri(self) -> str:
"""Asset URI. Value is cached after first call."""
Expand Down
2 changes: 1 addition & 1 deletion scripts/azureml-assets/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="azureml-assets",
version="1.16.71",
version="1.16.72",
description="Utilities for publishing assets to Azure Machine Learning system registries.",
author="Microsoft Corp",
packages=find_packages(),
Expand Down
Loading