0

I want to include some functionality via an azure function along with my managed app and was hoping I could include it in the .zip file you specify which has your mainTemplate.json and createUiDefinition.json files in it.

If so, where do you put them, and then how are they configured to run? What identity do they run as, what is their URL, etc? Can they just be "consumption" model (i.e. CPU allocated as needed instead of a dedicated server pool)? These are all low-frequency, high-latency type operations I want to provide.

I've found documentation that says you can put additional resources in the .zip file but nowhere that talks about actually doing it or how to use them.

Of if I'm totally off base, how does one provide specific behaviors along with a managed app to a customer? I'd really rather not host the functions myself, but if that's how you have to do it...

Thank you.

xaxxon
  • 19,189
  • 5
  • 50
  • 80

1 Answers1

0

This guide here has a section on deployment artifacts, which includes the information you need: https://github.com/Azure/azure-quickstart-templates/blob/master/1-CONTRIBUTION-GUIDE/best-practices.md

To summarise that page, you can include your scripts anywhere in the zip, but best practice is to not have it at the top level. To get the URI in the main template, you need to add the following parameters:

  "parameters": {
      "_artifactsLocation": {
          "type": "string",
          "metadata": {
              "description": "The base URI where artifacts required by this template are located including a trailing '/'"
          },
          "defaultValue": "[deployment().properties.templateLink.uri]"
      },
      "_artifactsLocationSasToken": {
          "type": "securestring",
          "metadata": {
              "description": "The sasToken required to access _artifactsLocation if needed."
          },
          "defaultValue": ""
      }
  },

Then get the full path to your resource using the URI function, like in this example:

"variables": {
        "scriptFileUri": "[uri(parameters('_artifactsLocation'), concat('scripts/configuration.sh', parameters('_artifactsLocationSasToken')))]",
        "nestedtemplateUri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/jumpbox.json', parameters('_artifactsLocationSasToken')))]"
    },
Steven Hardy
  • 101
  • 6