Reputation: 306
Could somebody share some insights in how to use an Azure Custom Provider Resource, that was published in another subscription , within Bicep? Doing the same via cli (https://learn.microsoft.com/en-us/azure/azure-resource-manager/custom-providers/tutorial-custom-providers-create?tabs=azure-cli#create-a-custom-resource) already works like a charm for me
{
"$schema": "http://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.CustomProviders/resourceProviders",
"name": "xxx",
"apiVersion": "2018-09-01-preview",
"location": "eastus",
"properties": {
"actions": [
{
"name": "myCustomAction",
"routingType": "Proxy",
"endpoint": "functionappurl"
}
],
"resourceTypes": [
{
"name": "myCustomResources",
"routingType": "Proxy",
"endpoint": "functionappurl"
}
]
}
}
]
}
Upvotes: 0
Views: 246
Reputation: 8038
I have created a custom provider using Json
template by referring to the given MSDoc and was deployed successfully.
{
"$schema": "http://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.CustomProviders/resourceProviders",
"name": "myCustomProvider",
"apiVersion": "2018-09-01-preview",
"location": "eastus",
"properties": {
"actions": [
{
"name": "myCustomAction",
"routingType": "Proxy",
"endpoint": "https://sampleaps.azurewebsites.net?code=APH3aFJeUmBU5x2pNOR_ZiUoiOUsJIYFFYinYi0cdxopAzFuI3c_KA=="
}
],
"resourceTypes": [
{
"name": "myCustomResources",
"routingType": "Proxy",
"endpoint": "https://sampleaps.azurewebsites.net?code=APH3aFJeUmBU5x2pNOR_ZiUoiOUsJIYFFYinYi0cdxopAzFuI3c_KA=="
}
]
}
}
]
}
Once it is deployed, you can refer it using existing
keyword in a bicep file which you are going to create.
param customprovidername string = 'myCustomProvider'
resource existingprovider 'Microsoft.CustomProviders/resourceProviders@2018-09-01-preview' existing = {
name: customprovidername
}
resource respname 'Microsoft.CustomProviders/resourceProviders/mycustomProvider@2018-09-01-preview' = {
name: '${customprovidername}/newres'
location: 'EastUs'
properties: {}
}
Upvotes: 0