In this article, let’s discuss about the functions from az namespace. There are two such functions – deployment and environment.
This is a function that returns information about current ongoing deployment. The returned object properties may differ. It depends on whether you are deploying a local bicep file or the target scope of the bicep file ( resource group vs one of the management group | tenant | subscription).
The code snippet given below shows a bicep file. It basically tries to create a storage account. After the deployment is done, there is an output parameter, which is an object. This object gets its value from the deployment function.
This is another function from the az function. This function returns the information about Azure environment used for deployment. The usage of this function is same as the previous function.
output deploymentInfo object = environment()
In addition to these two functions, there are some other functions too from the az namespance. Some of those functions are:
keyVaultName.getSecret(secretName)– to get the secret from the key vault. We have used this in the key vault demo.
- extensionResourceId – to get the resource ID for an extension resource. Typically, we can use symbolic name and its id property to get the same value.
- resourceId – this also returns unique identifier for the resource. For this as well, we can use symbolic name and its id property to get the same value.
- tenantId – to get the unique identifier
- managementGroup – Returns object containing information about management group
- resourceGroup – Returns object containing information about resource group
- subscription – Returns object containing information about subscription
- tenant – Returns information about the tenant
All the above mentioned functions are from az namespace. In order to understand the object returned by these functions, I would recommend to try them yourself in the bicep file and try to use those functions.
I hope you find this information helpful. Let me know your thoughts.