Your resume api in Azure serverless
Create an API with Azure Function that displays your resume information in json.
For local developer environment
NOTE At the moment, GitHub Free for personal accounts comes with 15 GB of Codespaces storage and 120 Core hours per month. Read more about pricing here
Code
button, click on Codespaces
tab, and click on Create Codespaces on main
. I've provided a devcontainer.json
file with the configuration needed for this project.src
folder and rename local.settings.sample.json
to local.settings.json
az login --use-device-code
to log into your Azure account from the az cli in your Codespace.az account list --output table
to get a list of Azure subscriptions you have available to you and make note of the name you want to use.az account set --name "name-of-subscription"
with the name of the subscription you want to use.az account show
and make sure it's set to the subscription you want to work in.NOTE: I've set the resource group name to be
rg-serverlessresumeapi
infra
folder. Now we need to use those files to create a deployment in Azure, in the Terminal, type:
az deployment sub create --template-file ./infra/main.bicep -l <your-region>
az deployment group show -g rg-serverlessresumeapi -n resources --query properties.outputs
output=$(az deployment group show -g rg-serverlessresumeapi -n resources --query properties.outputs)
functionAppName=$(echo $output | jq -r '.functionAppName.value')
functionUri=$(echo $output | jq -r '.functionUri.value')
storageAccountName=$(echo $output | jq -r '.storageAccountName.value')
echo "Function App Name: $functionAppName"
echo "Function URI: $functionUri"
echo "Storage Account Name: $storageAccountName"
myresume.json
to that newly created blob container.
az storage blob upload --account-name $storageAccountName --container-name resume --name myresume.json --file myresume.json
local.settings.json
add the Storage Account Connection String to the AzureWebJobsStorage
value. You can get that value by running this command:
az storage account show-connection-string --name $storageAccountName --resource-group rg-serverlessresumeapi
cd src
func start host
build.yml
and update the AZURE_FUNCTIONAPP_NAME
value with the name of your function app.az functionapp deployment list-publishing-profiles --name $functionAppName --resource-group rg-serverlessresumeapi --xml
AZURE_FUNCTIONAPP_PUBLISH_PROFILE
with the contents of your publish profile you just copied.curl $functionUri/getresume
/api/getresume
at the end./api/getresume
at the end.