[App Config] Migrate to Bicep (#30857)
And update API versions. Live tests run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4070946&view=results
This commit is contained in:
Родитель
1260758729
Коммит
79f55f52c1
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appconfiguration/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/appconfiguration/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
@minLength(5)
|
||||
param baseName string = resourceGroup().name
|
||||
param testApplicationOid string
|
||||
param location string = resourceGroup().location
|
||||
param sku string = 'Standard'
|
||||
param azConfigPrefix string = 'azconfig-resource-js'
|
||||
|
||||
var roleDefinitionId = '5ae67dd6-50cb-40e7-96ff-dc2bfa4b606b'
|
||||
var uniqueAzConfigName = '${baseName}-${azConfigPrefix}'
|
||||
|
||||
// Create Azure App Configuration Store
|
||||
resource azConfigStore 'Microsoft.AppConfiguration/configurationStores@2023-09-01-preview' = {
|
||||
name: uniqueAzConfigName
|
||||
location: location
|
||||
sku: {
|
||||
name: sku
|
||||
}
|
||||
}
|
||||
|
||||
// Assign Role to Test Application
|
||||
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
|
||||
name: guid(resourceGroup().id)
|
||||
properties: {
|
||||
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionId)
|
||||
principalId: testApplicationOid
|
||||
}
|
||||
}
|
||||
|
||||
// Outputs
|
||||
output AZ_CONFIG_ENDPOINT string = azConfigStore.properties.endpoint
|
|
@ -1,85 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"baseName": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().name]",
|
||||
"metadata": {
|
||||
"description": "The base resource name."
|
||||
}
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The tenant ID to which the application and resources belong."
|
||||
}
|
||||
},
|
||||
"testApplicationId": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The application client ID used to run tests."
|
||||
}
|
||||
},
|
||||
"testApplicationOid": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The client OID to grant access to test resources."
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().location]",
|
||||
"metadata": {
|
||||
"description": "The location of the resource. By default, this is the same as the resource group."
|
||||
}
|
||||
},
|
||||
"sku": {
|
||||
"defaultValue": "Standard",
|
||||
"type": "string"
|
||||
},
|
||||
"azConfigPrefix": {
|
||||
"defaultValue": "azconfig-resource-js",
|
||||
"type": "string"
|
||||
},
|
||||
"azConfigEndpointSuffix": {
|
||||
"defaultValue": ".azconfig.io",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"configurationApiVersion": "2019-10-01",
|
||||
"roleDefinitionId": "[format('/subscriptions/{0}/providers/Microsoft.Authorization/roleDefinitions/5ae67dd6-50cb-40e7-96ff-dc2bfa4b606b', subscription().subscriptionId)]",
|
||||
"uniqueAzConfigName": "[format('{0}-{1}', parameters('baseName'), parameters('azConfigPrefix'))]",
|
||||
"endpointValue": "[format('https://{0}-{1}{2}', parameters('baseName'), parameters('azConfigPrefix'), parameters('azConfigEndpointSuffix'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.AppConfiguration/configurationStores",
|
||||
"apiVersion": "[variables('configurationApiVersion')]",
|
||||
"name": "[variables('uniqueAzConfigName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"sku": {
|
||||
"name": "[parameters('sku')]"
|
||||
},
|
||||
"properties": {
|
||||
"endpoint": "[variables('endpointValue')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Authorization/roleAssignments",
|
||||
"apiVersion": "2018-09-01-preview",
|
||||
"name": "[guid(resourceGroup().id)]",
|
||||
"properties": {
|
||||
"roleDefinitionId": "[variables('roleDefinitionId')]",
|
||||
"principalId": "[parameters('testApplicationOid')]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"AZ_CONFIG_ENDPOINT": {
|
||||
"type": "string",
|
||||
"value": "[variables('endpointValue')]"
|
||||
},
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче