Outputs

Outputs are optional segments within an ARM template. Although they are optional, they play a very important role in the resource runtime values to the caller. This is very similar to how a function returns a value in a programming language. Of course, the function may choose not to return anything, but it is always considered good practice to return the execution status. ARM templates can be treated like functions where the caller provides parameters, executes the ARM template and the ARM template returns outputs as return value.

Defining outputs in an ARM template means listing all outputs along with their types. An example of an output is shown as follows. In this example, the output is a JSON object comprising all details related to a storage account:

"outputs": {
"storage": {
"type": "object",
"value": "[reference(parameters('storageAccountName'))]"
}
}

In the preceding example, the outputs segment consists of a single output, storage. Each output is a JSON object and consists of two properties, type and value. Type refers to the data type of a returned output, and can be of any type supported by ARM templates (such as integer, Boolean, string, array, SecureString, object, or SecureObject). Value refers to the actual value associated with an output. The value can be determined statically by hardcoding it, or it can be generated at runtime using expressions. It is considered a good practice to determine output dynamically at runtime using expressions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.79.121