# Azure MLでのスコアリングコードの使用

> Azure MLでのスコアリングコードの使用 - スコアリングコードモデルをAzure MLにインポートして、Azureを使った予測リクエストを行います。

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-15T05:55:44.913804+00:00` (UTC).

## Primary page

- [Azure MLでのスコアリングコードの使用](https://docs.datarobot.com/ja/docs/classic-ui/integrations/azure/sc-azureml.html.md): Full documentation for this topic (Markdown sidecar).

## Documentation content

スコアリングコードモデルをAzure MLにインポートする前に、以下のタスクを完了する必要があります。

- Azure CLIクライアント をインストールして、ターミナルへのサービスを設定します。
- Azure Machine Learning CLI拡張機能 をインストールします。

スコアリングコードモデルをAzure MLにインポートするには：

1. ログインコマンドを使用してAzureにログインします。 az login
2. リソースグループをまだ作成していない場合、このコマンドを使用してリソースグループを作成できます。 az group create --location --name [--subscription] [--tags] 例： az group create --location westus2 --name myresourcegroup
3. カスタムDocker画像の保存に使用する既存のコンテナレジストリがない場合、コンテナレジストリを作成する必要があります。 独自のイメージを作成するのではなく、DataRobot Dockerイメージを使用する場合は、コンテナレジストリを作成する必要はありません。 その場合は、手順6に進みます。 次のコマンドでコンテナを作成します。 az acr create --name --resource-group --sku {Basic | Classic | プレミアム機能 | Standard}
[--admin-enabled {false | true}] [--default-action {Allow | Deny}] [--location]
[--subscription] [--tags] [--workspace] 例： az acr create --name mycontainerregistry --resource-group myresourcegroup --sku Basic
4. 次のコマンドを使用して管理者アクセスをセットアップします。 az acr update --name --admin-enabled {false | true} 例： az acr update --name mycontainerregistry --admin-enabled true レジストリ認証情報を出力します。 az acr credential show --name 例： az acr credential show --name mycontainerregistry 戻り値： {
  "passwords": [
    {
      "name": "password",
      "value": <password>
    },
    {
      "name": "password2",
      "value": <password>
    }
  ],
  "username": mycontainerregistry
}
5. Javaを実行するカスタムDockerイメージをアップロードします。 az acr build --registry [--auth-mode {Default | None}] [--build-arg] [--file] [--image]
[--no-format] [--no-logs] [--no-push] [--no-wait] [--platform] [--resource-group]
[--secret-build-arg] [--subscription] [--target] [--timeout] [] 例： az acr build --registry mycontainerregistry --image myImage:1 --resource-group myresourcegroup --file Dockerfile . カスタムDocker画像の例を以下に示します。 イメージ構築の詳細については、Microsoftのドキュメントを参照してください。 FROM ubuntu:16.04

ARG CONDA_VERSION=4.5.12
ARG PYTHON_VERSION=3.6

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/miniconda/bin:$PATH

RUN apt-get update --fix-missing && \
    apt-get install -y wget bzip2 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p /opt/miniconda && \
    rm ~/miniconda.sh && \
    /opt/miniconda/bin/conda clean -tipsy

RUN conda install -y conda=${CONDA_VERSION} python=${PYTHON_VERSION} && \
    conda clean -aqy && \
    rm -rf /opt/miniconda/pkgs && \
    find / -type d -name __pycache__ -prune -exec rm -rf {} \;

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install software-properties-common -y && \
    add-apt-repository ppa:openjdk-r/ppa -y && \
    apt-get update -q && \
    apt-get install -y openjdk-11-jdk && \
    apt-get clean
6. ワークスペースを作成していない場合は、次のコマンドを使用してワークスペースを作成します。 それ以外の場合は、手順7に進みます。 az ml workspace create --workspace-name [--application-insights] [--container-registry]
[--exist-ok] [--friendly-name] [--keyvault] [--location] [--resource-group] [--sku]
[--storage-account] [--yes] 例： az ml workspace create --workspace-name myworkspace --resource-group myresourcegroup
7. Azureモデルストレージにスコアリングコードモデルを登録します。 備考続行する前に、DataRobotからスコアリングコードJARファイルをエクスポートしてください。 JARファイルはリーダーボードまたはデプロイからダウンロードできます。az mlモデル登録 --name [--asset-path][--cc] [--description][--experiment-name]
[--gb][--gc] [--model-framework][--model-framework-version] [--model-path][--output-metadata-file] [--path][--property] [--resource-group][--run-id]
[--run-metadata-file][--sample-input-dataset-id] [--sample-output-dataset-id][--tag] [--workspace-name][-v] codegenmodelという名前のモデルを登録する場合の例を以下に示します。 az ml model register --name codegenmodel --model-path 5cd071deef881f011a334c2f.jar --resource-group myresourcegroup --workspace-name myworkspace
8. 2つの構成、および予測を実行する1つのPythonエントリスクリプトを準備します。 Pythonエントリスクリプトを含む設定の例を以下に示します。
9. 新しい予測エンドポイントを作成します。 az ml model deploy --name [--ae] [--ai] [--ar] [--as] [--at] [--autoscale-max-replicas]
[--autoscale-min-replicas] [--base-image] [--base-image-registry] [--cc] [--cf]
[--collect-model-data] [--compute-target] [--compute-type] [--cuda-version] [--dc]
[--description] [--dn] [--ds] [--ed] [--eg] [--entry-script] [--environment-name]
[--environment-version] [--failure-threshold] [--gb] [--gc] [--ic] [--id] [--kp]
[--ks] [--lo] [--max-request-wait-time] [--model] [--model-metadata-file] [--namespace]
[--no-wait] [--nr] [--overwrite] [--path] [--period-seconds] [--pi] [--po] [--property]
[--replica-max-concurrent-requests] [--resource-group] [--rt] [--sc] [--scoring-timeout-ms]
[--sd] [--se] [--sk] [--sp] [--st] [--tag] [--timeout-seconds] [--token-auth-enabled]
[--workspace-name] [-v] myserviceという名前の新しいエンドポイントを作成する場合の例を以下に示します。 az ml model deploy --name myservice --model codegenmodel:1 --compute-target akscomputetarget --ic inferenceconfig.json --dc deploymentconfig.json --resource-group myresourcegroup --workspace-name myworkspace
10. 予測リクエストを作成するトークンを取得します。 az ml service get-keys --name [--path] [--resource-group] [--workspace-name] [-v] 例： az ml service get-keys --name myservice --resource-group myresourcegroup --workspace-name myworkspace 次のコマンドは、JSON応答を返します。 {
    "primaryKey": <key>,
    "secondaryKey": <key>
}

これでAzureを使用して予測リクエストを作成できるようになります。
