0

I have extracted the ARM template belonging to the preview version of Azure App Configuration, and am setting it into our IaC repository - so far so good.

Our next logical step is to include insertion of the AppConfiguration.PrimaryKey into our Key Vault. However I do not know the name of this property, and I can not find any information on the subject online. Also I can not see the AppConfiguration/configurationStores type listed in resources.azure.com (assuming its because its still in public preview).

Does anyone know how to reference the primary key (and possibly the read-only primary key), so i can reference them through a "outputs" variable in my arm template?

Then I can let Az Cli/Az Powershell insert the secret into our Key Vault, and we obtain full automation of our IaC

Markus Foss
  • 335
  • 4
  • 14

2 Answers2

0

I was not able to figure this out.

However by using az cli commands in a IaC script (which anyways invokes the arm template residing in a azure blob store) I circumvented the problem:

$connStrings = az appconfig credential list -n $configName| ConvertFrom-Json 
$readOnlyConnString = ($connStrings | Where {$_.name -eq "Primary Read Only"}).connectionString
$primaryConnString = ($connStrings | Where {$_.name -eq "Primary"}).connectionString

#then

az keyvault secret set --vault-name $kvName --name $keyNameRO --value $readOnlyConnString
az keyvault secret set --vault-name $kvName --name $keyNamePrimary --value $primaryConnString
Markus Foss
  • 335
  • 4
  • 14
0

For an ARM template I did the following. The listkeys function returns a full list of all the values that have to do with the keys. This was hard to figure out. I hope it helps.

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "configurationStores_instance_name": {
        "defaultValue": "ac-instance",
        "type": "String"
    }
},
"variables": {
    "apiVersionVar": "[providers('Microsoft.AppConfiguration', 'configurationStores').apiVersions[0]]",
    "resourceId": "[resourceId('Microsoft.AppConfiguration/configurationStores', parameters('configurationStores_instance_name'))]",
},
"resources": [
    {
        "type": "Microsoft.AppConfiguration/configurationStores",
        "apiVersion": "2019-10-01",
        "name": "[parameters('configurationStores_instance_name')]",
        "location": "northcentralus",
        "sku": {
            "name": "standard"
        },
        "properties": {}
    }
],
"outputs": {
    "AppConfigEndpoint": {
        "type": "string",
        "value": "[reference(parameters('configurationStores_instance_name')).endpoint]"
    },
    "AppConfigKeys": {
        "type": "Array",
        "value": "[listkeys(variables('resourceId'), variables('apiVersionVar')).value]"
    }
}

}

hope this helps!

Will Tartak
  • 548
  • 7
  • 17