Skip to content

Commit eef0576

Browse files
committed
indents
1 parent 3d2f4ca commit eef0576

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

articles/machine-learning/how-to-use-serverless-compute.md

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -138,33 +138,33 @@ When you [view your usage and quota in the Azure portal](how-to-manage-quotas.md
138138

139139
# [Python SDK](#tab/python)
140140

141-
```python
142-
from azure.ai.ml import MLClient
143-
from azure.identity import DefaultAzureCredential
144-
145-
subscription_id = "<your-subscription-id>"
146-
resource_group = "<your-resource-group>"
147-
workspace = "<your-workspace-name>"
148-
149-
ml_client = MLClient(
150-
DefaultAzureCredential(),
151-
subscription_id,
152-
resource_group,
153-
workspace
154-
)
155-
156-
# Get workspace details
157-
ws = ml_client.workspaces.get(name=workspace)
158-
print(ws)
159-
160-
```
141+
```python
142+
from azure.ai.ml import MLClient
143+
from azure.identity import DefaultAzureCredential
144+
145+
subscription_id = "<your-subscription-id>"
146+
resource_group = "<your-resource-group>"
147+
workspace = "<your-workspace-name>"
148+
149+
ml_client = MLClient(
150+
DefaultAzureCredential(),
151+
subscription_id,
152+
resource_group,
153+
workspace
154+
)
155+
156+
# Get workspace details
157+
ws = ml_client.workspaces.get(name=workspace)
158+
print(ws)
159+
160+
```
161161

162162
# [Azure CLI](#tab/cli)
163163

164-
```bash
165-
166-
az ml workspace show --name <wsname> --resource-group <rgname>
167-
```
164+
```bash
165+
166+
az ml workspace show --name <wsname> --resource-group <rgname>
167+
```
168168
---
169169
Look for the user assigned identities in the output. If it's missing, create a new workspace with a user assigned managed identity by following the instructions here: Set up service authentication - Azure Machine Learning | Microsoft Learn
170170

@@ -173,41 +173,41 @@ When you [view your usage and quota in the Azure portal](how-to-manage-quotas.md
173173

174174
# [Python SDK](#tab/python)
175175

176-
```python
177-
from azure.ai.ml import command
178-
from azure.ai.ml import MLClient # Handle to the workspace
179-
from azure.identity import DefaultAzureCredential # Authentication package
180-
from azure.ai.ml.entities import ResourceConfiguration
181-
from azure.ai.ml.entities import ManagedIdentityConfiguration
182-
183-
credential = DefaultAzureCredential()
184-
# Get a handle to the workspace. You can find the info on the workspace tab on ml.azure.com
185-
ml_client = MLClient(
186-
credential=credential,
187-
subscription_id="<Azure subscription id>",
188-
resource_group_name="<Azure resource group>",
189-
workspace_name="<Azure Machine Learning Workspace>",
190-
)
191-
job = command(
192-
command="echo 'hello world'",
193-
environment="azureml://registries/azureml/environments/sklearn-1.5/labels/latest",
194-
identity= ManagedIdentityConfiguration(client_id="<workspace-uami-client-id>"),
195-
)
196-
# submit the command job
197-
ml_client.create_or_update(job)
198-
199-
```
176+
```python
177+
from azure.ai.ml import command
178+
from azure.ai.ml import MLClient # Handle to the workspace
179+
from azure.identity import DefaultAzureCredential # Authentication package
180+
from azure.ai.ml.entities import ResourceConfiguration
181+
from azure.ai.ml.entities import ManagedIdentityConfiguration
182+
183+
credential = DefaultAzureCredential()
184+
# Get a handle to the workspace. You can find the info on the workspace tab on ml.azure.com
185+
ml_client = MLClient(
186+
credential=credential,
187+
subscription_id="<Azure subscription id>",
188+
resource_group_name="<Azure resource group>",
189+
workspace_name="<Azure Machine Learning Workspace>",
190+
)
191+
job = command(
192+
command="echo 'hello world'",
193+
environment="azureml://registries/azureml/environments/sklearn-1.5/labels/latest",
194+
identity= ManagedIdentityConfiguration(client_id="<workspace-uami-client-id>"),
195+
)
196+
# submit the command job
197+
ml_client.create_or_update(job)
198+
199+
```
200200

201201
# [Azure CLI](#tab/cli)
202202

203-
```bash
204-
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
205-
command: echo "hello world"
206-
environment:
207-
image: library/python:latest
208-
identity:
209-
type: managed
210-
```
203+
```bash
204+
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
205+
command: echo "hello world"
206+
environment:
207+
image: library/python:latest
208+
identity:
209+
type: managed
210+
```
211211

212212
---
213213

0 commit comments

Comments
 (0)