Z tego artykułu dowiesz się, jak nawiązać połączenie z usługami magazynu danych platformy Azure za pomocą usługi Azure Machine Edukacja magazynów danych.
Wymagania wstępne
Subskrypcja platformy Azure. Jeśli nie masz subskrypcji platformy Azure, przed rozpoczęciem utwórz bezpłatne konto. Wypróbuj bezpłatną lub płatną wersję usługi Azure Machine Edukacja.
Magazyny danych Edukacja maszyny nie tworzą podstawowych zasobów konta magazynu. Zamiast tego łączą istniejące konto magazynu dla Edukacja użycia maszyny. Magazyny danych Edukacja maszyny nie są wymagane. Jeśli masz dostęp do danych bazowych, możesz bezpośrednio użyć identyfikatorów URI magazynu.
Tworzenie magazynu danych obiektów blob platformy Azure
from azure.ai.ml.entities import AzureBlobDatastore
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureBlobDatastore(
name="",
description="",
account_name="",
container_name=""
)
ml_client.create_or_update(store)
from azure.ai.ml.entities import AzureBlobDatastore
from azure.ai.ml.entities import AccountKeyConfiguration
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureBlobDatastore(
name="blob_protocol_example",
description="Datastore pointing to a blob container using https protocol.",
account_name="mytestblobstore",
container_name="data-container",
protocol="https",
credentials=AccountKeyConfiguration(
account_key="XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
),
)
ml_client.create_or_update(store)
from azure.ai.ml.entities import AzureBlobDatastore
from azure.ai.ml.entities import SasTokenConfiguration
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureBlobDatastore(
name="blob_sas_example",
description="Datastore pointing to a blob container using SAS token.",
account_name="mytestblobstore",
container_name="data-container",
credentials=SasTokenConfiguration(
sas_token= "?xx=XXXX-XX-XX&xx=xxxx&xxx=xxx&xx=xxxxxxxxxxx&xx=XXXX-XX-XXXXX:XX:XXX&xx=XXXX-XX-XXXXX:XX:XXX&xxx=xxxxx&xxx=XXxXXXxxxxxXXXXXXXxXxxxXXXXXxxXXXXXxXXXXxXXXxXXxXX"
),
)
ml_client.create_or_update(store)
# my_blob_datastore.yml
$schema: https://azuremlschemas.azureedge.net/latest/azureBlob.schema.json
name: my_blob_ds # add your datastore name here
type: azure_blob
description: here is a description # add a datastore description here
account_name: my_account_name # add the storage account name here
container_name: my_container_name # add the storage container name here
Utwórz magazyn danych usługi Machine Edukacja w interfejsie wiersza polecenia platformy Azure:
az ml datastore create --file my_blob_datastore.yml
Utwórz ten plik YAML (zaktualizuj odpowiednie wartości):
from azure.ai.ml.entities import AzureDataLakeGen2Datastore
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureDataLakeGen2Datastore(
name="",
description="",
account_name="",
filesystem=""
)
ml_client.create_or_update(store)
from azure.ai.ml.entities import AzureDataLakeGen2Datastore
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureDataLakeGen2Datastore(
name="adls_gen2_example",
description="Datastore pointing to an Azure Data Lake Storage Gen2.",
account_name="mytestdatalakegen2",
filesystem="my-gen2-container",
credentials=ServicePrincipalCredentials(
tenant_id= "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
client_id= "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
client_secret= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
),
)
ml_client.create_or_update(store)
Utwórz ten plik YAML (zaktualizuj wartości):
# my_adls_datastore.yml
$schema: https://azuremlschemas.azureedge.net/latest/azureDataLakeGen2.schema.json
name: adls_gen2_credless_example
type: azure_data_lake_gen2
description: Credential-less datastore pointing to an Azure Data Lake Storage Gen2 instance.
account_name: mytestdatalakegen2
filesystem: my-gen2-container
Utwórz magazyn danych machine Edukacja w interfejsie wiersza polecenia:
az ml datastore create --file my_adls_datastore.yml
Utwórz ten plik YAML (zaktualizuj wartości):
# my_adls_datastore.yml
$schema: https://azuremlschemas.azureedge.net/latest/azureDataLakeGen2.schema.json
name: adls_gen2_example
type: azure_data_lake_gen2
description: Datastore pointing to an Azure Data Lake Storage Gen2 instance.
account_name: mytestdatalakegen2
filesystem: my-gen2-container
credentials:
tenant_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client_secret: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Utwórz magazyn danych machine Edukacja w interfejsie wiersza polecenia:
az ml datastore create --file my_adls_datastore.yml
from azure.ai.ml.entities import AzureFileDatastore
from azure.ai.ml.entities import AccountKeyConfiguration
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureFileDatastore(
name="file_example",
description="Datastore pointing to an Azure File Share.",
account_name="mytestfilestore",
file_share_name="my-share",
credentials=AccountKeyConfiguration(
account_key= "XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
),
)
ml_client.create_or_update(store)
from azure.ai.ml.entities import AzureFileDatastore
from azure.ai.ml.entities import SasTokenConfiguration
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureFileDatastore(
name="file_sas_example",
description="Datastore pointing to an Azure File Share using SAS token.",
account_name="mytestfilestore",
file_share_name="my-share",
credentials=SasTokenConfiguration(
sas_token="?xx=XXXX-XX-XX&xx=xxxx&xxx=xxx&xx=xxxxxxxxxxx&xx=XXXX-XX-XXXXX:XX:XXX&xx=XXXX-XX-XXXXX:XX:XXX&xxx=xxxxx&xxx=XXxXXXxxxxxXXXXXXXxXxxxXXXXXxxXXXXXxXXXXxXXXxXXxXX"
),
)
ml_client.create_or_update(store)
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureDataLakeGen1Datastore(
name="",
store_name="",
description="",
)
ml_client.create_or_update(store)
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
from azure.ai.ml import MLClient
ml_client = MLClient.from_config()
store = AzureDataLakeGen1Datastore(
name="adls_gen1_example",
description="Datastore pointing to an Azure Data Lake Storage Gen1.",
store_name="mytestdatalakegen1",
credentials=ServicePrincipalCredentials(
tenant_id= "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
client_id= "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
client_secret= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
),
)
ml_client.create_or_update(store)
Utwórz ten plik YAML (zaktualizuj wartości):
# my_adls_datastore.yml
$schema: https://azuremlschemas.azureedge.net/latest/azureDataLakeGen1.schema.json
name: alds_gen1_credless_example
type: azure_data_lake_gen1
description: Credential-less datastore pointing to an Azure Data Lake Storage Gen1 instance.
store_name: mytestdatalakegen1
Utwórz magazyn danych machine Edukacja w interfejsie wiersza polecenia:
az ml datastore create --file my_adls_datastore.yml
Utwórz ten plik YAML (zaktualizuj wartości):
# my_adls_datastore.yml
$schema: https://azuremlschemas.azureedge.net/latest/azureDataLakeGen1.schema.json
name: adls_gen1_example
type: azure_data_lake_gen1
description: Datastore pointing to an Azure Data Lake Storage Gen1 instance.
store_name: mytestdatalakegen1
credentials:
tenant_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client_secret: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Utwórz magazyn danych machine Edukacja w interfejsie wiersza polecenia:
az ml datastore create --file my_adls_datastore.yml
Tworzenie magazynu danych usługi OneLake (Microsoft Fabric) (wersja zapoznawcza)
W tej sekcji opisano różne opcje tworzenia magazynu danych OneLake. Magazyn danych OneLake jest częścią usługi Microsoft Fabric. Obecnie usługa Machine Edukacja obsługuje połączenie z artefaktami usługi Lakehouse usługi Microsoft Fabric, które obejmują foldery lub pliki i skróty Amazon S3. Aby uzyskać więcej informacji na temat lakehouses, zobacz Co to jest lakehouse w usłudze Microsoft Fabric?.
Tworzenie magazynu danych oneLake wymaga następujących informacji z wystąpienia usługi Microsoft Fabric:
Punkt końcowy
Nazwa obszaru roboczego sieci szkieletowej lub identyfikator GUID
Nazwa artefaktu lub identyfikator GUID
Na poniższych trzech zrzutach ekranu opisano pobieranie tych wymaganych zasobów informacji z wystąpienia usługi Microsoft Fabric.
Nazwa obszaru roboczego usługi OneLake
W wystąpieniu usługi Microsoft Fabric można znaleźć informacje o obszarze roboczym, jak pokazano na tym zrzucie ekranu. Aby utworzyć magazyn danych Machine Edukacja OneLake, możesz użyć wartości GUID lub "przyjaznej nazwy".
Punkt końcowy usługi OneLake
Ten zrzut ekranu przedstawia sposób znajdowania informacji o punkcie końcowym w wystąpieniu usługi Microsoft Fabric.
Nazwa artefaktu oneLake
Ten zrzut ekranu przedstawia sposób znajdowania informacji o artefaktach w wystąpieniu usługi Microsoft Fabric. Zrzut ekranu przedstawia również sposób użycia wartości identyfikatora GUID lub przyjaznej nazwy do utworzenia magazynu danych usługi Machine Edukacja OneLake.