This is a continuation of previous article which showed how to connect azure app service to an azure sql database using azure cli, it is important to read part 1 before this article so as to be aware of the prerequisites and some azure terms.
In this article, I'll demonstrate how to use azure cli to connect an azure app service to a storage account, this is similar to previous article but with slight differences
Prerequisites
- An Azure account with an active subscription.
- Azure Cloud shell or a Azure CLI installed on local machine.
Steps
- Login into your azure account using
az login
command. - Create your script and save on an editor using .ps1 extension; then navigate to the directory where script is saved and run the script.
Note: Always ensure the storage account name is unique in lowercase and does not include special characters (like the screenshot above, I had to change the name to something unique demoaccount901
).
Feel free to change your location and variable names.
Ensure the variable names on the script is preceded by $ to avoid errors like screenshot below on powershell.
As with the previous post, the following will be created: a resource group, app service plan and web app.
After that a storage account with a unique name will be created, through which our app service will connect with to store data.
Retrieving the connection string from the storage account to have access to stored data in app service.
And lastly assigning connection string to an app setting which are exposed as environment variables.
- Viewing the created resources within the resource group on the azure portal.
- Clean up resources with
az group delete --name $resourceGroup
Thank you for reading and I hope you learned something new, view script on my repo
The End!!!
Top comments (0)