Goal:
Here we will learn about creating and deploying our first azure function app on azure cloud, everything from command line.
Here we will learn about creating and deploying our first azure function app on azure cloud, everything from command line.
Steps:
First we will start with installing all
preliminary command line utilities. And then we will create function locally to test, debug and then we will deploy it on the azure cloud function app.
- Install npm as most of azure utilities written in node, so to download all dependencies we will require
npm.
- Install python3 pip, virtual env with few other python development dependencies as we gonna develop our first app in python.
- Install azure function command line utility to initialize, debug and publish functions and azure cli to interact with azure cloud.
- Create virtual env in python and activate it.
- Initialize first function project
- Create first azure function on local system.
- Start your function and test it locally.
- Test using curl commands
curl http://localhost:7071/api/BasicHttpExample
curl http://localhost:7071/api/BasicHttpExample?name=piyushMandovra
- Login using azure cli so that you can deploy on azure cloud from command line. It will take you to browser to
login your azure account.
- Publish it on azure cloud function app you have created from browser. Make sure function app is already created and you don't
have any other function already deployed on function app other wise it will overwrite with whatever local
version you have.
sudo apt install npm
sudo apt install -y python3-pip python3-venv build-essential libssl-dev libffi-dev python3-dev
sudo npm install -g azure-functions-core-tools
func --version
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az --version
python3 -m venv my_env
source my_env/bin/activate
func init LocalFunctionProj --python
cd LocalFunctionProj/
func new --name BasicHttpExample --template "HTTP trigger"
func start
az login
func azure functionapp publish FunctionAPPName
Check out my article for Grey Market premium of Anupam Rasayan IPO GMP
ReplyDelete