diff --git a/.github/infrastructure/conformance/azure/conf-test-azure-container-registry.bicep b/.github/infrastructure/conformance/azure/conf-test-azure-container-registry.bicep new file mode 100644 index 000000000..7eb513953 --- /dev/null +++ b/.github/infrastructure/conformance/azure/conf-test-azure-container-registry.bicep @@ -0,0 +1,24 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation and Dapr Contributors. +// Licensed under the MIT License. +// ------------------------------------------------------------ + +param acrName string +param rgLocation string = resourceGroup().location +param acrSku string = 'Standard' +param confTestTags object = {} + +resource acrResource 'Microsoft.ContainerRegistry/registries@2021-06-01-preview' = { + name: acrName + location: rgLocation + tags: confTestTags + sku: { + name: acrSku + } + properties: { + adminUserEnabled: false + } +} + +@description('Output the login server property for later use') +output loginServer string = acrResource.properties.loginServer diff --git a/.github/infrastructure/conformance/azure/conf-test-azure.bicep b/.github/infrastructure/conformance/azure/conf-test-azure.bicep index a3ff21765..911e75084 100644 --- a/.github/infrastructure/conformance/azure/conf-test-azure.bicep +++ b/.github/infrastructure/conformance/azure/conf-test-azure.bicep @@ -38,6 +38,7 @@ param certAuthSpId string param sqlServerAdminPassword string var confTestRgName = '${toLower(namePrefix)}-conf-test-rg' +var acrName = '${toLower(namePrefix)}registry' var cosmosDbName = '${toLower(namePrefix)}-conf-test-db' var eventGridTopicName = '${toLower(namePrefix)}-conf-test-eventgrid-topic' var eventHubsNamespaceName = '${toLower(namePrefix)}-conf-test-eventhubs' @@ -53,6 +54,15 @@ resource confTestRg 'Microsoft.Resources/resourceGroups@2021-04-01' = { tags: confTestTags } +module acr 'conf-test-azure-container-registry.bicep' = { + name: acrName + scope: resourceGroup(confTestRg.name) + params: { + confTestTags: confTestTags + acrName: acrName + } +} + module cosmosDb 'conf-test-azure-cosmosdb.bicep' = { name: cosmosDbName scope: resourceGroup(confTestRg.name) @@ -130,6 +140,7 @@ module storage 'conf-test-azure-storage.bicep' = { } output confTestRgName string = confTestRg.name +output acrName string = acr.name output cosmosDbName string = cosmosDb.name output cosmosDbSqlName string = cosmosDb.outputs.cosmosDbSqlName output cosmosDbSqlContainerName string = cosmosDb.outputs.cosmosDbSqlContainerName diff --git a/.github/infrastructure/conformance/azure/setup-azure-conf-test.sh b/.github/infrastructure/conformance/azure/setup-azure-conf-test.sh index a4cb450e2..28340c338 100755 --- a/.github/infrastructure/conformance/azure/setup-azure-conf-test.sh +++ b/.github/infrastructure/conformance/azure/setup-azure-conf-test.sh @@ -153,6 +153,8 @@ echo "CREDENTIALS_PATH=${CREDENTIALS_PATH}" ##============================================================================== # Constant environment variable names defined by tests or GitHub workflow +ACR_VAR_NAME="AzureContainerRegistryName" + COSMOS_DB_VAR_NAME="AzureCosmosDB" COSMOS_DB_COLLECTION_VAR_NAME="AzureCosmosDBCollection" COSMOS_DB_MASTER_KEY_VAR_NAME="AzureCosmosDBMasterKey" @@ -296,6 +298,8 @@ SQL_SERVER_NAME="$(az deployment sub show --name "${DEPLOY_NAME}" --query "prope echo "INFO: SQL_SERVER_NAME=${SQL_SERVER_NAME}" SQL_SERVER_ADMIN_NAME="$(az deployment sub show --name "${DEPLOY_NAME}" --query "properties.outputs.sqlServerAdminName.value" --output tsv)" echo "INFO: SQL_SERVER_ADMIN_NAME=${SQL_SERVER_ADMIN_NAME}" +AZURE_CONTAINER_REGISTRY_NAME="$(az deployment sub show --name "${DEPLOY_NAME}" --query "properties.outputs.acrName.value" --output tsv)" +echo "INFO: AZURE_CONTAINER_REGISTRY_NAME=${CONTAINER_REGISTRY_NAME}" # Give the service principal used by the SDK write access to the entire resource group MSYS_NO_PATHCONV=1 az role assignment create --assignee "${SDK_AUTH_SP_ID}" --role "Contributor" --scope "/subscriptions/${SUB_ID}/resourceGroups/${RESOURCE_GROUP_NAME}" @@ -597,6 +601,14 @@ IOT_HUB_PUBSUB_CONSUMER_GROUP_NAME="$(basename ${IOT_HUB_PUBSUB_CONSUMER_GROUP_F echo export ${IOT_HUB_PUBSUB_CONSUMER_GROUP_VAR_NAME}=\"${IOT_HUB_PUBSUB_CONSUMER_GROUP_NAME}\" >> "${ENV_CONFIG_FILENAME}" az keyvault secret set --name "${IOT_HUB_PUBSUB_CONSUMER_GROUP_VAR_NAME}" --vault-name "${KEYVAULT_NAME}" --value "${IOT_HUB_PUBSUB_CONSUMER_GROUP_NAME}" +# --------------------------------------- +# Populate Managed Identity Test settings +# --------------------------------------- +echo "Configuring Azure Container Registry for Managed Identity Certification tests ..." +echo export ${ACR_VAR_NAME}=\"${AZURE_CONTAINER_REGISTRY_NAME}\" >> "${ENV_CONFIG_FILENAME}" +az keyvault secret set --name "${ACR_VAR_NAME}" --vault-name "${KEYVAULT_NAME}" --value "${AZURE_CONTAINER_REGISTRY_NAME}" + + # --------------------------- # Display completion message # ---------------------------