You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-studio/how-to/deploy-models-serverless.md
+135-3Lines changed: 135 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,17 @@ In this article, you learn how to deploy a model from the model catalog as a ser
79
79
)
80
80
```
81
81
82
+
# [Bicep](#tab/bicep)
83
+
84
+
Install the Azure CLI as described at [Azure CLI](/cli/azure/).
85
+
86
+
Configure the following environment variables according to your settings:
87
+
88
+
```azurecli
89
+
RESOURCE_GROUP="serverless-models-dev"
90
+
LOCATION="eastus2"
91
+
```
92
+
82
93
# [ARM](#tab/arm)
83
94
84
95
You can use any compatible web browser to [deploy ARM templates](../../azure-resource-manager/templates/deploy-portal.md) in the Microsoft Azure portal or use any of the deployment tools. This tutorial uses the [Azure CLI](/cli/azure/).
@@ -108,6 +119,9 @@ The next section covers the steps for subscribing your project to a model offeri
108
119
109
120
For non-Microsoft models offered through the Azure Marketplace, you can deploy them to serverless API endpoints to consume their predictions. If it's your first time deploying the model in the project, you have to subscribe your project for the particular model offering from the Azure Marketplace. Each project has its own subscription to the particular Azure Marketplace offering of the model, which allows you to control and monitor spending.
110
121
122
+
> [!TIP]
123
+
> Skip this step if you are deploying models from the Phi-3 family of models. Directly [deploy the model to a serverless API endpoint](#deploy-the-model-to-a-serverless-api-endpoint).
124
+
111
125
> [!NOTE]
112
126
> Models offered through the Azure Marketplace are available for deployment to serverless API endpoints in specific regions. Check [Model and region availability for Serverless API deployments](deploy-models-serverless-availability.md) to verify which models and regions are available. If the one you need is not listed, you can deploy to a workspace in a supported region and then [consume serverless API endpoints from a different workspace](deploy-models-serverless-connect.md).
113
127
@@ -158,11 +172,41 @@ For non-Microsoft models offered through the Azure Marketplace, you can deploy t
158
172
).result()
159
173
```
160
174
175
+
# [Bicep](#tab/bicep)
176
+
177
+
Use the following bicep configuration to create a model subscription:
var modelName = substring(modelId, (lastIndexOf(modelId, '/') + 1))
186
+
var subscriptionName = '${modelName}-subscription'
187
+
188
+
resource projectName_subscription 'Microsoft.MachineLearningServices/workspaces/marketplaceSubscriptions@2024-04-01-preview' = if (!startsWith(
189
+
modelId,
190
+
'azureml://registries/azureml/'
191
+
)) {
192
+
name: '${projectName}/${subscriptionName}'
193
+
properties: {
194
+
modelId: modelId
195
+
}
196
+
}
197
+
```
198
+
199
+
Then create the resource as follows:
200
+
201
+
```azurecli
202
+
az deployment group create --resource-group $RESOURCE_GROUP --template-file model-subscription.bicep
203
+
```
204
+
161
205
# [ARM](#tab/arm)
162
206
163
207
Use the following template to create a model subscription:
164
208
165
-
__template.json__
209
+
__model-subscription.json__
166
210
167
211
```json
168
212
{
@@ -196,6 +240,12 @@ For non-Microsoft models offered through the Azure Marketplace, you can deploy t
196
240
}
197
241
```
198
242
243
+
Use the Azure portal or the Azure CLI to create the deployment.
244
+
245
+
```azurecli
246
+
az deployment group create --resource-group $RESOURCE_GROUP --template-file model-subscription.json
247
+
```
248
+
199
249
1. Once you subscribe the project for the particular Azure Marketplace offering, subsequent deployments of the same offering in the same project don't require subscribing again.
200
250
201
251
1. At any point, you can see the model offers to which your project is currently subscribed:
@@ -227,6 +277,15 @@ For non-Microsoft models offered through the Azure Marketplace, you can deploy t
227
277
print(sub.as_dict())
228
278
```
229
279
280
+
# [Bicep](#tab/bicep)
281
+
282
+
You can use the resource management tools to query the resources. The following code uses Azure CLI:
283
+
284
+
```azurecli
285
+
az resource list \
286
+
--query "[?type=='Microsoft.SaaS']"
287
+
```
288
+
230
289
# [ARM](#tab/arm)
231
290
232
291
You can use the resource management tools to query the resources. The following code uses Azure CLI:
@@ -292,6 +351,46 @@ In this section, you create an endpoint with the name **meta-llama3-8b-qwerty**.
You can use the resource management tools to query the resources. The following code uses Azure CLI:
@@ -418,6 +525,10 @@ In this section, you create an endpoint with the name **meta-llama3-8b-qwerty**.
418
525
print(endpoint_keys.secondary_key)
419
526
```
420
527
528
+
# [Bicep](#tab/bicep)
529
+
530
+
Use REST APIs to query this information.
531
+
421
532
# [ARM](#tab/arm)
422
533
423
534
Use REST APIs to query this information.
@@ -435,6 +546,18 @@ Models deployed in Azure Machine Learning and Azure AI studio in Serverless API
435
546
436
547
Read more about the [capabilities of this API](../reference/reference-model-inference-api.md#capabilities) and how [you can use it when building applications](../reference/reference-model-inference-api.md#getting-started).
437
548
549
+
## Network isolation
550
+
551
+
Endpoints for models deployed as Serverless APIs follow the public network access (PNA) flag setting of the AI Studio Hub that has the project in which the deployment exists. To secure your MaaS endpoint, disable the PNA flag on your AI Studio Hub. You can secure inbound communication from a client to your endpoint by using a private endpoint for the hub.
552
+
553
+
To set the PNA flag for the Azure AI hub:
554
+
555
+
1. Go to the [Azure portal](https://portal.azure.com).
556
+
2. Search for the Resource group to which the hub belongs, and select your Azure AI hub from the resources listed for this Resource group.
557
+
3. On the hub Overview page, use the left navigation pane to go to Settings > Networking.
558
+
4. Under the **Public access** tab, you can configure settings for the public network access flag.
559
+
5. Save your changes. Your changes might take up to five minutes to propagate.
560
+
438
561
## Delete endpoints and subscriptions
439
562
440
563
You can delete model subscriptions and endpoints. Deleting a model subscription makes any associated endpoint become *Unhealthy* and unusable.
@@ -494,6 +617,15 @@ To delete the associated model subscription:
0 commit comments