Skip to content

Commit 0f8c833

Browse files
committed
Add baseline aml online endpoint action
1 parent 9dce769 commit 0f8c833

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM python:3.9
2+
3+
WORKDIR /app
4+
5+
COPY entrypoint.py /app/
6+
COPY requirements.txt /app/
7+
8+
RUN pip install -r requirements.txt
9+
10+
ENTRYPOINT ["python", "/app/entrypoint.py"]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Deploy Azure ML Online Endpoint'
2+
description: 'Creates an Azure ML Online Endpoint'
3+
inputs:
4+
azure_credentials:
5+
description: 'Azure credentials (JSON) for authentication'
6+
required: true
7+
subscription_id:
8+
description: 'Azure Subscription ID'
9+
required: true
10+
resource_group:
11+
description: 'Azure Resource Group'
12+
required: true
13+
workspace_name:
14+
description: 'Azure ML Workspace Name'
15+
required: true
16+
endpoint_name:
17+
description: 'Name of the Azure ML Online Endpoint'
18+
required: true
19+
auth_mode:
20+
description: 'Authentication mode for the endpoint (key or aml_token)'
21+
required: false
22+
default: 'key'
23+
24+
runs:
25+
using: 'docker'
26+
image: 'Dockerfile'
27+
28+
branding:
29+
icon: 'cloud'
30+
color: 'blue'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
import json
3+
from azure.ai.ml import MLClient
4+
from azure.ai.ml.entities import ManagedOnlineEndpoint
5+
from azure.identity import DefaultAzureCredential
6+
7+
# Read inputs from GitHub Action environment variables
8+
azure_credentials = json.loads(os.getenv('INPUT_AZURE_CREDENTIALS'))
9+
subscription_id = os.getenv('INPUT_SUBSCRIPTION_ID')
10+
resource_group = os.getenv('INPUT_RESOURCE_GROUP')
11+
workspace_name = os.getenv('INPUT_WORKSPACE_NAME')
12+
endpoint_name = os.getenv('INPUT_ENDPOINT_NAME')
13+
auth_mode = os.getenv('INPUT_AUTH_MODE', 'key')
14+
15+
# Authenticate with Azure
16+
ml_client = MLClient(
17+
DefaultAzureCredential(), subscription_id, resource_group, workspace_name
18+
)
19+
20+
# Create endpoint
21+
endpoint = ManagedOnlineEndpoint(name=endpoint_name, auth_mode=auth_mode)
22+
ml_client.online_endpoints.begin_create_or_update(endpoint).result()
23+
24+
print(f"✅ Online endpoint '{endpoint_name}' created successfully.")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
azure-ai-ml
2+
azure-identity

0 commit comments

Comments
 (0)