Могу ли я включить или сослаться на содержимое файла в виде строкового значения в шаблоне Azure Resource Manager? - PullRequest
0 голосов
/ 21 февраля 2020

Я пытаюсь написать шаблоны для развертывания некоторого примера API в API Management. Теперь некоторые значения свойств довольно длинные и сложные. Например, у меня есть эта политика

 {
            "type": "Microsoft.ApiManagement/service/policies",
            "apiVersion": "2019-01-01",
            "name": "[concat(parameters('service_apim_name'), '/policy')]",
            "dependsOn": [
                "[resourceId('Microsoft.ApiManagement/service', parameters('service_simon_hm_name'))]"
            ],
            "properties": {
                "value": "<!--\r\n    IMPORTANT:\r\n    - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\r\n    - Only the <forward-request> policy element can appear within the <backend> section element.\r\n    - To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element.\r\n    - To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element.\r\n    - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\r\n    - To remove a policy, delete the corresponding policy statement from the policy document.\r\n    - Policies are applied in the order of their appearance, from the top down.\r\n-->\r\n<policies>\r\n  <inbound></inbound>\r\n  <backend>\r\n    <forward-request />\r\n  </backend>\r\n  <outbound></outbound>\r\n</policies>",
                "format": "xml"
            }
        }

Как разбить значение политики на файл XML?

1 Ответ

0 голосов
/ 29 февраля 2020

Вы не можете сделать это сегодня ... вы можете приблизить его, поместив значение в KeyVault и извлекая его оттуда, но сегодня в платформе нет поведения типа #include.

Некоторые люди делают их собственная предварительная обработка на клиенте ...

...