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
# Quickstart: Create a custom provider and deploy custom resources
11
+
# Quickstart: Create a custom resource provider and deploy custom resources
12
12
13
-
In this quickstart, you create your own resource provider and deploy custom resource types for that resource provider. For more information about custom providers, see [Azure Custom Providers Preview overview](overview.md).
13
+
In this quickstart, you create a custom resource provider and deploy custom resources for that resource provider. For more information about custom providers, see [Azure Custom Resource Providers Overview](overview.md).
14
14
15
15
## Prerequisites
16
16
@@ -29,22 +29,22 @@ Azure CLI examples use `az rest` for `REST` requests. For more information, see
29
29
30
30
- The PowerShell commands are run locally using PowerShell 7 or later and the Azure PowerShell modules. For more information, see [Install Azure PowerShell](/powershell/azure/install-az-ps).
31
31
- If you don't already have a tool for `REST` operations, install the [ARMClient](https://github.com/projectkudu/ARMClient). It's an open-source command-line tool that simplifies invoking the Azure Resource Manager API.
32
-
- After the **ARMClient** is installed you can display usage information from a PowerShell command prompt by typing: `armclient.exe`. Or, go to the [ARMClient wiki](https://github.com/projectkudu/ARMClient/wiki).
32
+
- After the **ARMClient** is installed, you can display usage information from a PowerShell command prompt by typing: `armclient.exe`. Or, go to the [ARMClient wiki](https://github.com/projectkudu/ARMClient/wiki).
33
33
34
34
---
35
35
36
36
## Deploy custom provider
37
37
38
-
To set up the custom provider, deploy an [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/custom-providers/customprovider.json) to your Azure subscription.
38
+
To set up the custom resource provider, deploy an [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/custom-providers/customprovider.json) to your Azure subscription.
39
39
40
-
After deploying the template, your subscription has the following resources:
40
+
The template deploys the following resources to your subscription:
41
41
42
-
- Function App with the operations for the resources and actions.
43
-
- Storage Account for storing users that are created through the custom provider.
44
-
- Custom Provider that defines the custom resource types and actions. It uses the function app endpoint for sending requests.
45
-
- Custom resource from the custom provider.
42
+
- Function app with the operations for the resources and actions.
43
+
- Storage account for storing users that are created through the custom provider.
44
+
- Custom resource provider that defines the custom resource types and actions. It uses the function app endpoint for sending requests.
45
+
- Custom resource from the custom resource provider.
46
46
47
-
To deploy the custom provider, use Azure CLI, PowerShell, or the Azure portal:
47
+
To deploy the custom resource provider, use Azure CLI, PowerShell, or the Azure portal.
You can also deploy the solution from the Azure portal. Select the **Deploy to Azure** button to open the template in the Azure portal.
80
+
To deploy the template from the Azure portal, select the **Deploy to Azure** button.
81
81
82
82
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-docs-json-samples%2Fmaster%2Fcustom-providers%2Fcustomprovider.json)
83
83
84
-
## View custom provider and resource
84
+
## View custom resource provider and resource
85
85
86
-
In the portal, the custom provider is a hidden resource type. To confirm that the resource provider was deployed, navigate to the resource group. Select the option to**Show hidden types**.
86
+
In the portal, the custom resource provider is a hidden resource type. To confirm that the resource provider was deployed, go to the resource group and select**Show hidden types**.
:::image type="content" source="./media/create-custom-provider/show-hidden.png" alt-text="Screenshot that shows hidden resource types and resources deployed in Azure.":::
89
89
90
-
To see the custom resource type that you deployed, use the `GET` operation on your resource type.
90
+
To see the custom resource that you deployed, use the `GET` operation on your resource type. The resource type `Microsoft.CustomProviders/resourceProviders/users` shown in the JSON response includes the resource that was created by the template.
91
91
92
92
```http
93
93
GET https://management.azure.com/subscriptions/<sub-id>/resourceGroups/<rg-name>/providers/Microsoft.CustomProviders/resourceProviders/<provider-name>/users?api-version=2018-09-01-preview
Your custom provider also has an action named `ping`. The code that processes the request is implemented in the function app. The `ping` action replies with a greeting.
155
+
Your custom resource provider also has an action named `ping`. The code that processes the request is implemented in the function app. The `ping` action replies with a greeting.
157
156
158
-
To send a `ping` request, use the `POST` operation on your custom provider.
157
+
To send a `ping` request, use the `POST` operation on your action.
159
158
160
159
```http
161
160
POST https://management.azure.com/subscriptions/<sub-id>/resourceGroups/<rg-name>/providers/Microsoft.CustomProviders/resourceProviders/<provider-name>/ping?api-version=2018-09-01-preview
@@ -200,9 +199,11 @@ You receive the response:
200
199
201
200
---
202
201
203
-
## Create a resource type
202
+
## Use PUT to create resource
203
+
204
+
In this quickstart, the template used the resource type `Microsoft.CustomProviders/resourceProviders/users` to deploy a resource. You can also use a `PUT` operation to create a resource. For example, if a resource isn't deployed with the template, the `PUT` operation will create a resource.
204
205
205
-
To create the custom resource type, you can deploy the resource in a template. This approach is shown in the template you deployed in this quickstart. You can also send a `PUT`request for the resource type.
206
+
In this example, because the template already deployed a resource, the `PUT`operation creates a new resource.
206
207
207
208
```http
208
209
PUT https://management.azure.com/subscriptions/<sub-id>/resourceGroups/<rg-name>/providers/Microsoft.CustomProviders/resourceProviders/<provider-name>/users/<resource-name>?api-version=2018-09-01-preview
You can rerun the `GET` operation from the [view custom resource provider and resource](#view-custom-resource-provider-and-resource) section to show the two resources that were created. This example shows output from the Azure CLI command.
Use the [custom-providers](/cli/azure/custom-providers/resource-provider) commands to work with your custom resource provider.
@@ -358,6 +387,25 @@ The `delete` command prompts you and deletes only the custom resource provider.
358
387
az custom-providers resource-provider delete --resource-group $rgName --name $funcName
359
388
```
360
389
390
+
## Clean up resources
391
+
392
+
If you're finished with the resources created in this article, you can delete the resource group. When you delete a resource group, all the resources in that resource group are deleted.
393
+
394
+
# [Azure CLI](#tab/azure-cli)
395
+
396
+
```azurecli-interactive
397
+
az group delete --resource-group $rgName
398
+
```
399
+
400
+
# [PowerShell](#tab/azure-powershell)
401
+
402
+
```azurepowershell-interactive
403
+
Remove-AzResourceGroup -Name $rgName
404
+
```
405
+
406
+
---
407
+
408
+
361
409
## Next steps
362
410
363
411
For an introduction to custom providers, see the following article:
0 commit comments