From 49e285af775e293875060a626fc7911303c2d1ca Mon Sep 17 00:00:00 2001 From: Basel Rustum Date: Mon, 23 Nov 2020 11:36:04 -0800 Subject: [PATCH] TSI: Add default values for ARM parameters (#17133) --- .../tests/prerequisites/setup.ps1 | 1 - sdk/timeseriesinsights/test-resources.bicep | 34 ++++++++++------ sdk/timeseriesinsights/test-resources.json | 40 +++++++++++-------- 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/prerequisites/setup.ps1 b/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/prerequisites/setup.ps1 index 4ec9f66fd3c1..bded8c149248 100644 --- a/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/prerequisites/setup.ps1 +++ b/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/prerequisites/setup.ps1 @@ -114,7 +114,6 @@ $timeSeriesIdProperties = $timeSeriesIdProperties.Replace('"','\"') az deployment group create --resource-group $ResourceGroup --name $($EnvironmentName.ToLower()) --template-file $armTemplateFile --parameters ` region=$Region ` resourceGroup=$ResourceGroup ` - subscriptionId=$SubscriptionId ` environmentName=$EnvironmentName ` iotHubName=$($EnvironmentName + "-hub") ` consumerGroupName=$ConsumerGroupName ` diff --git a/sdk/timeseriesinsights/test-resources.bicep b/sdk/timeseriesinsights/test-resources.bicep index cfc52971600c..7376519c3dd8 100644 --- a/sdk/timeseriesinsights/test-resources.bicep +++ b/sdk/timeseriesinsights/test-resources.bicep @@ -1,13 +1,8 @@ -param subscriptionId string { - metadata: { - description: 'The subscription Id where the resources will be deployed.' - } -} - param iotHubName string { metadata: { description: 'The name of the source IoT hub.' } + default: az.resourceGroup().name } param testApplicationOid string { @@ -23,17 +18,18 @@ param region string { default: az.resourceGroup().location } -param consumerGroupName string { +param environmentName string { metadata: { - description: 'The name of the consumer group that the Time Series Insights service will use to read the data from the event hub. NOTE: To avoid resource contention, this consumer group must be dedicated to the Time Series Insights service and not shared with other readers.' + description: 'Name of the environment. The name cannot include: \'<\', \'>\', \'%\', \'&\', \':\', \'\\\', \'?\', \'/\' and any control characters. All other characters are allowed.' } + maxLength: 90 } -param environmentName string { +param consumerGroupName string { metadata: { - description: 'Name of the environment. The name cannot include: \'<\', \'>\', \'%\', \'&\', \':\', \'\\\', \'?\', \'/\' and any control characters. All other characters are allowed.' + description: 'The name of the consumer group that the Time Series Insights service will use to read the data from the event hub. NOTE: To avoid resource contention, this consumer group must be dedicated to the Time Series Insights service and not shared with other readers.' } - maxLength: 90 + default: concat(environmentName, 'CG') } param environmentTimeSeriesIdProperties array { @@ -41,6 +37,16 @@ param environmentTimeSeriesIdProperties array { description: 'Time Series ID acts as a partition key for your data and as a primary key for your time series model. It is important that you specify the appropriate Time Series Property ID during environment creation, since you cannot change it later. Note that the Property ID is case sensitive. You can use 1-3 keys: one is required, but up to three can be used to create a composite.' } maxLength: 3 + default: [ + { + 'name': 'timeseriesinsights.id' + 'type': 'string' + } + { + 'name': 'id' + 'type': 'string' + } + ] } param eventSourceName string { @@ -48,13 +54,14 @@ param eventSourceName string { description: 'Name of the event source child resource. The name cannot include: \'<\', \'>\', \'%\', \'&\', \':\', \'\\\', \'?\', \'/\' and any control characters. All other characters are allowed.' } maxLength: 90 + default: concat(environmentName, 'EventSourceName') } param resourceGroup string { - default: az.resourceGroup().name metadata: { description: 'If you have an existing IotHub provide the name here. Defaults to the same resource group as the TSI environnment.' } + default: az.resourceGroup().name } param eventSourceTimestampPropertyName string { @@ -62,13 +69,14 @@ param eventSourceTimestampPropertyName string { description: 'The event property that will be used as the event source\'s timestamp. If a value is not specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.' } maxLength: 90 + default: concat(eventSourceName, 'TimestampPropertyName') } param eventSourceKeyName string { - default : 'service' metadata: { description: 'The name of the shared access key that the Time Series Insights service will use to connect to the event hub.' } + default : 'service' } var rbacOwnerRoleDefinitionId = '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635' diff --git a/sdk/timeseriesinsights/test-resources.json b/sdk/timeseriesinsights/test-resources.json index 360767d98ee0..5109d1ca78f0 100644 --- a/sdk/timeseriesinsights/test-resources.json +++ b/sdk/timeseriesinsights/test-resources.json @@ -2,17 +2,12 @@ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "subscriptionId": { - "type": "string", - "metadata": { - "description": "The subscription Id where the resources will be deployed." - } - }, "iotHubName": { "type": "string", "metadata": { "description": "The name of the source IoT hub." - } + }, + "defaultValue": "[resourceGroup().name]" }, "testApplicationOid": { "type": "string", @@ -27,12 +22,6 @@ }, "defaultValue": "[resourceGroup().location]" }, - "consumerGroupName": { - "type": "string", - "metadata": { - "description": "The name of the consumer group that the Time Series Insights service will use to read the data from the event hub. NOTE: To avoid resource contention, this consumer group must be dedicated to the Time Series Insights service and not shared with other readers." - } - }, "environmentName": { "type": "string", "maxLength": 90, @@ -40,19 +29,37 @@ "description": "Name of the environment. The name cannot include: '<', '>', '%', '&', ':', '\\', '?', '/' and any control characters. All other characters are allowed." } }, + "consumerGroupName": { + "type": "string", + "metadata": { + "description": "The name of the consumer group that the Time Series Insights service will use to read the data from the event hub. NOTE: To avoid resource contention, this consumer group must be dedicated to the Time Series Insights service and not shared with other readers." + }, + "defaultValue": "[concat(parameters('environmentName'), 'CG')]" + }, "environmentTimeSeriesIdProperties": { "type": "array", "maxLength": 3, "metadata": { "description": "Time Series ID acts as a partition key for your data and as a primary key for your time series model. It is important that you specify the appropriate Time Series Property ID during environment creation, since you cannot change it later. Note that the Property ID is case sensitive. You can use 1-3 keys: one is required, but up to three can be used to create a composite." - } + }, + "defaultValue": [ + { + "name": "timeseriesinsights.id", + "type": "string" + }, + { + "name": "id", + "type": "string" + } + ] }, "eventSourceName": { "type": "string", "maxLength": 90, "metadata": { "description": "Name of the event source child resource. The name cannot include: '<', '>', '%', '&', ':', '\\', '?', '/' and any control characters. All other characters are allowed." - } + }, + "defaultValue": "[concat(parameters('environmentName'), 'EventSourceName')]" }, "resourceGroup": { "type": "string", @@ -66,7 +73,8 @@ "maxLength": 90, "metadata": { "description": "The event property that will be used as the event source's timestamp. If a value is not specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used." - } + }, + "defaultValue": "[concat(parameters('eventSourceName'), 'TimestampPropertyName')]" }, "eventSourceKeyName": { "type": "string",