azure - ARM 模板:获取 IOT hub 的 SKU
解决方案
如果要获取iot hub的sku inarm模板,可以使用arm模板函数“reference”:
[reference(resourceId('Microsoft.Devices/IotHubs', 'hubname'),'2018-04-01','Full')]
例如
模板
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"hubname": {
"type": "String"
},
"location": {
"type": "String"
},
"sku_name": {
"type": "String"
},
"sku_units": {
"type": "String"
},
"d2c_partitions": {
"type": "String"
},
"features": {
"type": "String"
},
"tags": {
"type": "Object"
},
"cloudEnvironment": {
"defaultValue": "public",
"allowedValues": [
"public",
"china",
"usgov"
],
"type": "String",
"metadata": {
"description": "Cloud environment to deploy (i.e. usgov/china/ ...)"
}
}
},
"resources": [
{
"type": "Microsoft.Devices/IotHubs",
"apiVersion": "2020-07-10-preview",
"name": "[parameters('hubname')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
"sku": {
"name": "[parameters('sku_name')]",
"capacity": "[parameters('sku_units')]"
},
"properties": {
"eventHubEndpoints": {
"events": {
"retentionTimeInDays": 1,
"partitionCount": "[parameters('d2c_partitions')]"
}
},
"features": "[parameters('features')]"
}
},
{
"type": "Microsoft.Security/IoTSecuritySolutions",
"apiVersion": "2019-08-01",
"name": "[parameters('hubname')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Devices/IotHubs', parameters('hubname'))]"
],
"properties": {
"status": "Enabled",
"unmaskedIpLoggingStatus": "Enabled",
"disabledDataSources": [],
"displayName": "[parameters('hubname')]",
"iotHubs": [
"[resourceId('Microsoft.Devices/IotHubs', parameters('hubname'))]"
],
"recommendationsConfiguration": []
}
}
],
"outputs": {
"iot": {
"type": "Object",
"value": "[reference(resourceId('Microsoft.Devices/IotHubs', parameters('hubname')),'2018-04-01','Full').sku]"
}
}
}
范围
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hubname": {
"value": "testiot05"
},
"location": {
"value": "eastasia"
},
"sku_name": {
"value": "S1"
},
"sku_units": {
"value": "1"
},
"d2c_partitions": {
"value": "4"
},
"features": {
"value": "None"
},
"tags": {
"value": {}
},
"cloudEnvironment": {
"value": "public"
}
}
}
推荐阅读
- optimization - 查询优化建议
- powershell - 如何将带有附加道具的 PSCustomObject 转换为自定义类
- activemq-artemis - 在 Artemis 共置 HA 配置中从从属故障恢复到主控不起作用
- mysql - 如何从终端访问和修改 phpmyadmin 数据库?
- python - 用于简单显示的最佳 Python UI 框架(无直接交互)
- ruby-on-rails - Rails Webpacker - 如何从视图 [HTML 文件] 访问 webpack 条目文件中定义的对象
- azure - 将 Azure SQL 弹性数据库克隆到不同资源组中的非弹性服务器
- json - 使用 HASH 作为 Snowflake 中的备用维度键?
- coldfusion - ColdFusion zip an entire folder
- ios - @Published 属性包装器及其 WrappedValue