[Tables] Migrate to Bicep (#30864)
And update API versions. Live tests run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4074280&view=results Failures are because of the new test sanitizers and not related to bicep.
This commit is contained in:
Родитель
e55fcc492f
Коммит
1bbfc2b264
|
@ -6,7 +6,7 @@
|
|||
# support for setting CORS rules is added to ARM for Tables
|
||||
|
||||
# It is invoked by the https://github.com/Azure/azure-sdk-for-js/blob/main/eng/New-TestResources.ps1
|
||||
# script after the ARM template, defined in https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/tables/test-resources.json,
|
||||
# script after the Bicep template, defined in https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/tables/test-resources.bicep,
|
||||
# is finished being deployed. The ARM template is responsible for creating the Storage accounts needed for live tests.
|
||||
|
||||
param (
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
param baseName string
|
||||
param baseTime string = utcNow('u')
|
||||
param testApplicationOid string
|
||||
|
||||
var storageEndpointSuffix = environment().suffixes.storage
|
||||
var storageApiVersion = '2023-05-01'
|
||||
var blobDataContributorRoleId = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')
|
||||
var location = resourceGroup().location
|
||||
var accountName = baseName
|
||||
var accountNameTidy = toLower(trim(accountName))
|
||||
var accountSasProperties = {
|
||||
signedServices: 'bfqt'
|
||||
signedPermission: 'rwdlacup'
|
||||
signedResourceTypes: 'sco'
|
||||
keyToSign: 'key2'
|
||||
signedExpiry: dateTimeAdd(baseTime, 'PT2H')
|
||||
}
|
||||
|
||||
// Role Assignment for Blob Data Contributor
|
||||
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
|
||||
name: guid('tableDataContributorRoleId', resourceGroup().id)
|
||||
properties: {
|
||||
roleDefinitionId: blobDataContributorRoleId
|
||||
principalId: testApplicationOid
|
||||
}
|
||||
}
|
||||
|
||||
// Storage Account
|
||||
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
|
||||
name: accountName
|
||||
location: location
|
||||
sku: {
|
||||
name: 'Standard_RAGRS'
|
||||
}
|
||||
kind: 'StorageV2'
|
||||
properties: {
|
||||
networkAcls: {
|
||||
bypass: 'AzureServices'
|
||||
virtualNetworkRules: []
|
||||
ipRules: []
|
||||
defaultAction: 'Allow'
|
||||
}
|
||||
supportsHttpsTrafficOnly: true
|
||||
encryption: {
|
||||
services: {
|
||||
file: {
|
||||
enabled: true
|
||||
}
|
||||
blob: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
keySource: 'Microsoft.Storage'
|
||||
}
|
||||
accessTier: 'Hot'
|
||||
}
|
||||
}
|
||||
|
||||
// Outputs
|
||||
output RESOURCE_GROUP_NAME string = resourceGroup().name
|
||||
output ACCOUNT_NAME string = accountName
|
||||
output ACCOUNT_KEY string = listKeys(storageAccount.id, storageApiVersion).keys[0].value
|
||||
output SAS_TOKEN string = '?${listAccountSas(accountNameTidy, storageApiVersion, accountSasProperties).accountSasToken}'
|
||||
output SAS_CONNECTION_STRING string = 'TableEndpoint=https://${accountName}.table.${storageEndpointSuffix}/;SharedAccessSignature=${listAccountSas(accountNameTidy, storageApiVersion, accountSasProperties).accountSasToken}'
|
||||
output ACCOUNT_CONNECTION_STRING string = 'DefaultEndpointsProtocol=https;AccountName=${accountName};AccountKey=${listKeys(storageAccount.id, storageApiVersion).keys[0].value};EndpointSuffix=${storageEndpointSuffix}'
|
||||
output TABLES_URL string = 'https://${accountName}.table.${storageEndpointSuffix}'
|
|
@ -1,118 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"baseName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The base resource name."
|
||||
}
|
||||
},
|
||||
"testApplicationOid": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The principal to assign the role to. This is application object id."
|
||||
}
|
||||
},
|
||||
"storageEndpointSuffix": {
|
||||
"type": "string",
|
||||
"defaultValue": "core.windows.net",
|
||||
"metadata": {
|
||||
"description": "Storage endpoint suffix. The default value uses Azure Public Cloud (core.windows.net)"
|
||||
}
|
||||
},
|
||||
"baseTime": {
|
||||
"type": "string",
|
||||
"defaultValue": "[utcNow('u')]"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"storageApiVersion": "2019-06-01",
|
||||
"authorizationApiVersion": "2018-09-01-preview",
|
||||
"blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"accountName": "[parameters('baseName')]",
|
||||
"resourceGroupName": "resourceGroup().name",
|
||||
"accountNameTidy": "[toLower(trim(variables('accountName')))]",
|
||||
"accountSasProperties": {
|
||||
"signedServices": "bfqt",
|
||||
"signedPermission": "rwdlacup",
|
||||
"signedResourceTypes": "sco",
|
||||
"keyToSign": "key2",
|
||||
"signedExpiry": "[dateTimeAdd(parameters('baseTime'), 'PT2H')]"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Authorization/roleAssignments",
|
||||
"apiVersion": "[variables('authorizationApiVersion')]",
|
||||
"name": "[guid(concat('tableDataContributorRoleId', resourceGroup().id))]",
|
||||
"properties": {
|
||||
"roleDefinitionId": "[variables('blobDataContributorRoleId')]",
|
||||
"principalId": "[parameters('testApplicationOid')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"apiVersion": "[variables('storageApiVersion')]",
|
||||
"name": "[variables('accountName')]",
|
||||
"location": "[variables('location')]",
|
||||
"sku": {
|
||||
"name": "Standard_RAGRS",
|
||||
"tier": "Standard"
|
||||
},
|
||||
"kind": "StorageV2",
|
||||
"properties": {
|
||||
"networkAcls": {
|
||||
"bypass": "AzureServices",
|
||||
"virtualNetworkRules": [],
|
||||
"ipRules": [],
|
||||
"defaultAction": "Allow"
|
||||
},
|
||||
"supportsHttpsTrafficOnly": true,
|
||||
"encryption": {
|
||||
"services": {
|
||||
"file": {
|
||||
"enabled": true
|
||||
},
|
||||
"blob": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"keySource": "Microsoft.Storage"
|
||||
},
|
||||
"accessTier": "Hot"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"RESOURCE_GROUP_NAME": {
|
||||
"type": "string",
|
||||
"value": "[variables('resourceGroupName')]"
|
||||
},
|
||||
"ACCOUNT_NAME": {
|
||||
"type": "string",
|
||||
"value": "[variables('accountName')]"
|
||||
},
|
||||
"ACCOUNT_KEY": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('accountName')), variables('storageApiVersion')).keys[0].value]"
|
||||
},
|
||||
"SAS_TOKEN": {
|
||||
"type": "string",
|
||||
"value": "[concat('?', listAccountSas(variables('accountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]"
|
||||
},
|
||||
"SAS_CONNECTION_STRING": {
|
||||
"type": "string",
|
||||
"value": "[concat('TableEndpoint=https://', variables('accountName'), '.table.', parameters('storageEndpointSuffix'), '/;', 'SharedAccessSignature=', listAccountSas(variables('accountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]"
|
||||
},
|
||||
"ACCOUNT_CONNECTION_STRING": {
|
||||
"type": "string",
|
||||
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('accountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('accountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]"
|
||||
},
|
||||
"TABLES_URL": {
|
||||
"type": "string",
|
||||
"value": "[concat('https://', variables('accountName'), '.table.', parameters('storageEndpointSuffix'))]"
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче