Skip to content

Update az login

Update az login #7

Workflow file for this run

name: Deploy Serverless FastAPI to Azure Function App
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Log in to Azure
run: |
az login --service-principal \
-t ${{ secrets.AZURE_TENANT_ID }} \
-u ${{ secrets.AZURE_CLIENT_ID }} \
-p ${{ secrets.AZURE_CLIENT_SECRET }}
- name: Create Storage Account
run: |
az storage account create \
--name ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }} \
--resource-group ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} \
--location japaneast \
--sku Standard_LRS
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Functions
run: |
az functionapp deployment source config-zip \
--resource-group ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} \
--name ${{ secrets.AZURE_FUNCTION_APP_NAME }} \
--src function_app.zip
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
- name: Publish Function App
run: |
func azure functionapp publish ${{ secrets.AZURE_FUNCTION_APP_NAME }}
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}