Skip to content

Commit 24a05f3

Browse files
authored
ADT/TSI: Remove persisted ARM template json file to entirely replace it with bicep support. (Azure#24173)
* Remove ARM template files from the repo since they are generated from the bicep file. * ignore ARM template files. * Update .gitignore * Update readme. * Update prerequisite readme.md
1 parent 18a5459 commit 24a05f3

File tree

8 files changed

+21
-351
lines changed

8 files changed

+21
-351
lines changed

sdk/digitaltwins/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
!*common.config.json
33
!*common.test.assets.config.json
44
*.etl
5+
test-resources.json*

sdk/digitaltwins/Azure.DigitalTwins.Core/tests/prerequisites/prerequisite readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ bicep --version
2222

2323
### Run the setup script
2424

25-
The script outputs [test-resources.bicep](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/digitaltwins/test-resources.bicep) file in the root folder [digitaltwins](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/digitaltwins)
25+
The script creates required resources in your azure subscription that allows you to run live tests against them. Run the following command:
2626

27-
- `.\setup.ps1`
27+
- `.\setup.ps1 -Region [YOUR REGION] -ResourceGroup [YOUR DESIRED RESOURCE GROUP NAME] -SubscriptionId [YOUR SUBSCRIPTION ID] -DigitalTwinName [YOUR DESIRED DIGITAL TWIN INSTANCE NAME] -AppRegistrationName [YOUR APP REGISTRATION] -Verbose`
2828

2929
### Generate the ARM template
3030

31-
The ARM template [test-resources.json](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/digitaltwins/test-resources.json) is generated from the [test-resources.bicep](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/digitaltwins/test-resources.bicep) file by running the following script
31+
The ARM template is generated from the [test-resources.bicep](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/digitaltwins/test-resources.bicep) file by running the following script
3232

3333
- `.\generateArmTemplate.ps1`
3434

sdk/digitaltwins/Azure.DigitalTwins.Core/tests/prerequisites/setup.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,17 @@ if ($rgExists -eq "False")
8484
az group create --name $ResourceGroup --location $Region --output none
8585
}
8686

87+
Write-Host "`nGenerating the ARM template using the cli bicep extention."
88+
$bicepFilePath = Join-Path -Path $PSScriptRoot -ChildPath "../../../test-resources.bicep";
89+
az bicep build --f $bicepFilePath
90+
8791
Write-Host "`nDeploying resources to $ResourceGroup in $Region`n"
8892

8993
$armTemplateFile = Join-Path -Path $PSScriptRoot -ChildPath "../../../test-resources.json";
9094

9195
if (-not (Test-Path $armTemplateFile -PathType leaf))
9296
{
93-
throw "`nARM template was not found. Please make sure you have an ARM template file named test-resources.json in the root of the service directory`n"
97+
throw "`nARM template was not found. Please make sure you have a bicep file called test-resources.bicep in the root of the service directory`n"
9498
}
9599

96100
# Deploy test-resources.json ARM template.
@@ -142,4 +146,6 @@ $protectedBytes = [Security.Cryptography.ProtectedData]::Protect($bytes, $null,
142146
Set-Content $outputFile -Value $protectedBytes -AsByteStream -Force
143147
Write-Host "`nTest environment settings stored into encrypted $outputFile`n"
144148

149+
Write-Host "`nRemoving generated ARM template JSON file."
150+
rm -r $armTemplateFile
145151
Write-Host "Done!"

sdk/digitaltwins/test-resources.json

Lines changed: 0 additions & 143 deletions
This file was deleted.

sdk/timeseriesinsights/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
!*common.test.assets.config.json
44
*.etl
55
params.*.json
6+
test-resources.json*

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/tests/prerequisites/prerequisite readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bicep --version
2424

2525
### Generate the ARM template
2626

27-
The ARM template [test-resources.json](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/timeseriesinsights/test-resources.json) is generated from the [test-resources.bicep](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/timeseriesinsights/test-resources.bicep) file by running the following script
27+
The ARM template is generated from the [test-resources.bicep](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/timeseriesinsights/test-resources.bicep) file by running the following script
2828

2929
- `.\generateArmTemplate.ps1`
3030

sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/tests/prerequisites/setup.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,17 @@ if ($rgExists -eq "False")
9090
az group create --name $ResourceGroup --location $Region --output none
9191
}
9292

93+
Write-Host "`nGenerating the ARM template using the cli bicep extention."
94+
$bicepFilePath = Join-Path -Path $PSScriptRoot -ChildPath "../../../test-resources.bicep";
95+
az bicep build --f $bicepFilePath
96+
9397
Write-Host "`nDeploying resources to $ResourceGroup in $Region`n"
9498

9599
$armTemplateFile = Join-Path -Path $PSScriptRoot -ChildPath "../../../test-resources.json";
96100

97101
if (-not (Test-Path $armTemplateFile -PathType leaf))
98102
{
99-
throw "`nARM template was not found. Please make sure you have an ARM template file named test-resources.json in the root of the service directory`n"
103+
throw "`nARM template was not found. Please make sure you have a bicep file called test-resources.bicep in the root of the service directory`n"
100104
}
101105

102106
# Format the Id properties before deployment
@@ -172,4 +176,7 @@ $protectedBytes = [Security.Cryptography.ProtectedData]::Protect($bytes, $null,
172176
Set-Content $outputFile -Value $protectedBytes -AsByteStream -Force
173177
Write-Host "`nTest environment settings stored into encrypted $outputFile`n"
174178

179+
Write-Host "`nRemoving generated ARM template JSON file."
180+
rm -r $armTemplateFile
181+
175182
Write-Host "Done!"

0 commit comments

Comments
 (0)