An Azure account with an active subscription.
For API to expose the API permissions and validate token
For API client to authenticate and acquire an access token for the API
python3 -V
Python 3.9.15
az --version
azure-cli 2.42.0
core 2.42.0
telemetry 1.0.8
Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
Python location '/usr/local/Cellar/azure-cli/2.42.0/libexec/bin/python'
Extensions directory '/Users/arnaudsene/.azure/cliextensions'
Python (Darwin) 3.10.8 (main, Oct 13 2022, 10:17:43) [Clang 14.0.0 (clang-1400.0.29.102)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
func init wiki-azure-func-fastapi-oauth2 --python
cd wiki-azure-func-fastapi-oauth2
ls -al
total 2048
drwxrwxrwx 1 arnaudsene staff 131072 Nov 13 15:47 .
drwxrwxrwx@ 1 arnaudsene staff 131072 Jul 15 18:11 ..
-rwxrwxrwx 1 arnaudsene staff 470 Nov 13 15:47 .gitignore
drwxrwxrwx 1 arnaudsene staff 131072 Nov 13 15:47 .vscode
-rwxrwxrwx 1 arnaudsene staff 2660 Nov 13 15:47 getting_started.md
-rwxrwxrwx 1 arnaudsene staff 288 Nov 13 15:47 host.json
-rwxrwxrwx 1 arnaudsene staff 117 Nov 13 15:47 local.settings.json
-rwxrwxrwx 1 arnaudsene staff 203 Nov 13 15:47 requirements.txt
python3.9 -m venv .venv
source .venv/bin/activate
python -V
Python 3.9.15
pip install --upgrade pip
func templates list -l python
Python Templates:
Azure Blob Storage trigger
Azure Cosmos DB trigger
Durable Functions activity
Durable Functions entity
Durable Functions HTTP starter
Durable Functions orchestrator
Azure Event Grid trigger
Azure Event Hub trigger
HTTP trigger
Kafka output
Kafka trigger
Azure Queue Storage trigger
RabbitMQ trigger
Azure Service Bus Queue trigger
Azure Service Bus Topic trigger
Timer trigger
func new --name weather --template "HTTP trigger" --authlevel "anonymous"
Select a number for template:HTTP trigger
Function name: [HttpTrigger] Writing /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2/weather/__init__.py
Writing /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2/weather/function.json
The function "weather" was created successfully from the "HTTP trigger" template.
Did you know? There is a new Python programming model in public preview. For fewer files and a decorator based approach, learn how you can try it out today at https://aka.ms/pythonprogrammingmodel
func start
Found Python version 3.9.15 (python3).
Azure Functions Core Tools
Core Tools Version: 4.0.4865 Commit hash: N/A (64-bit)
Function Runtime Version: 4.12.2.19454
[2022-11-13T20:59:02.559Z] Worker process started and initialized.
Functions:
weather: [GET,POST] http://localhost:7071/api/weather
For detailed output, run func with --verbose flag.
[2022-11-13T20:59:06.899Z] Host lock lease acquired by instance ID '0000000000000000000000006F6C816C'.
Test the url in your browser
request the URL
request the url with query
The doc is based on the official Code sample Using Flask Framework with Azure Functions
azure-functions
fastapi
fastapi_microsoft_identity
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
},
"extensions": {
"http": {
"routePrefix": ""
}
}
}
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
],
"route": "/{*route}"
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}
Note: for FastAPI, route can be in the form "{*route}"
mkdir routers
cd routers
touch weather.py
import logging
from fastapi import (
APIRouter,
Request,
Response
)
from fastapi_microsoft_identity import (
initialize,
requires_auth,
AuthError,
validate_scope
)
# API ID & Tenant ID
TID: str = "3f7bc283-72c9-4132-ba12-7e2f2b183209"
CID: str = "0d16fab0-48fe-4df0-81f7-9a6a144439b7"
router = APIRouter()
initialize(tenant_id_=TID, client_id_=CID)
expected_scope: str = "data.read"
@router.get("/{city}")
@requires_auth
async def get_weather(request: Request, city: str):
logging.info(f"Getting weather for {city}")
try:
validate_scope(expected_scope, request)
return {
"city": city,
"temperature": 20.2
}
except AuthError as exc:
return Response(
status_code=exc.status_code,
content=exc.error_msg
)
import azure.functions as func
from fastapi import FastAPI
from routers import weather
app = FastAPI()
app.include_router(weather.router, prefix="/weather")
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.AsgiMiddleware(app).handle(req)
Because we set OAuth2, we need to test through an application as Postman or Thunder Client.
In this doc Thunder Client has been chosen.
request the URL
request the url with query
az group create --name wiki-azure-func-fastapi-oauth2-rg --location "canadaeast"
Parameter persistence is turned on. Its information is saved in working directory /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2. You can run `az config param-persist off` to turn it off.
Your preference of --name: wiki-azure-func-fastapi-oauth2-rg, --location: canadaeast are now saved as persistent parameter. To learn more, type in `az config param-persist --help`
{
"id": "/subscriptions/60bc35fa-1ed3-4db3-b577-8de507555faa/resourceGroups/wiki-azure-func-fastapi-oauth2-rg",
"location": "canadaeast",
"managedBy": null,
"name": "wiki-azure-func-fastapi-oauth2-rg",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
az storage account create --name apisto --sku Standard_LRS
Parameter persistence is turned on. Its information is saved in working directory /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2. You can run `az config param-persist off` to turn it off.
Command argument values from persistent parameters: --resource-group: wiki-azure-func-fastapi-oauth2-rg, --location: canadaeast
Parameter persistence is turned on. Its information is saved in working directory /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2. You can run `az config param-persist off` to turn it off.
Your preference of --name: apisto is now saved as persistent parameter. To learn more, type in `az config param-persist --help`
{
"accessTier": "Hot",
"allowBlobPublicAccess": true,
"allowCrossTenantReplication": null,
"allowSharedKeyAccess": null,
"allowedCopyScope": null,
"azureFilesIdentityBasedAuthentication": null,
"blobRestoreStatus": null,
"creationTime": "2022-11-13T22:05:59.576845+00:00",
"customDomain": null,
"defaultToOAuthAuthentication": null,
"dnsEndpointType": null,
"enableHttpsTrafficOnly": true,
"enableNfsV3": null,
"encryption": {
"encryptionIdentity": null,
"keySource": "Microsoft.Storage",
"keyVaultProperties": null,
"requireInfrastructureEncryption": null,
"services": {
"blob": {
"enabled": true,
"keyType": "Account",
"lastEnabledTime": "2022-11-13T22:05:59.654957+00:00"
},
"file": {
"enabled": true,
"keyType": "Account",
"lastEnabledTime": "2022-11-13T22:05:59.654957+00:00"
},
"queue": null,
"table": null
}
},
"extendedLocation": null,
"failoverInProgress": null,
"geoReplicationStats": null,
"id": "/subscriptions/60bc35fa-1ed3-4db3-b577-8de507555faa/resourceGroups/wiki-azure-func-fastapi-oauth2-rg/providers/Microsoft.Storage/storageAccounts/apisto",
"identity": null,
"immutableStorageWithVersioning": null,
"isHnsEnabled": null,
"isLocalUserEnabled": null,
"isSftpEnabled": null,
"keyCreationTime": {
"key1": "2022-11-13T22:05:59.639329+00:00",
"key2": "2022-11-13T22:05:59.639329+00:00"
},
"keyPolicy": null,
"kind": "StorageV2",
"largeFileSharesState": null,
"lastGeoFailoverTime": null,
"location": "canadaeast",
"minimumTlsVersion": "TLS1_0",
"name": "apisto",
"networkRuleSet": {
"bypass": "AzureServices",
"defaultAction": "Allow",
"ipRules": [],
"resourceAccessRules": null,
"virtualNetworkRules": []
},
"primaryEndpoints": {
"blob": "https://apisto.blob.core.windows.net/",
"dfs": "https://apisto.dfs.core.windows.net/",
"file": "https://apisto.file.core.windows.net/",
"internetEndpoints": null,
"microsoftEndpoints": null,
"queue": "https://apisto.queue.core.windows.net/",
"table": "https://apisto.table.core.windows.net/",
"web": "https://apisto.z27.web.core.windows.net/"
},
"primaryLocation": "canadaeast",
"privateEndpointConnections": [],
"provisioningState": "Succeeded",
"publicNetworkAccess": null,
"resourceGroup": "wiki-azure-func-fastapi-oauth2-rg",
"routingPreference": null,
"sasPolicy": null,
"secondaryEndpoints": null,
"secondaryLocation": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"statusOfPrimary": "available",
"statusOfSecondary": null,
"storageAccountSkuConversionStatus": null,
"tags": {},
"type": "Microsoft.Storage/storageAccounts"
}
az functionapp create --consumption-plan-location canadaeast --runtime python --runtime-version 3.9 --functions-version 4 --name fastapi-weather --os-type linux --storage-account apisto
Parameter persistence is turned on. Its information is saved in working directory /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2. You can run `az config param-persist off` to turn it off.
Command argument values from persistent parameters: --resource-group: wiki-azure-func-fastapi-oauth2-rg
Your Linux function app 'fastapi-weather', that uses a consumption plan has been successfully created but is not active until content is published using Azure Portal or the Functions Core Tools.
Error while trying to create and configure an Application Insights for the Function App. Please use the Azure Portal to create and configure the Application Insights, if needed.
Parameter persistence is turned on. Its information is saved in working directory /Volumes/SATA_Data/macOS backup 2022-07-15/projects/wiki-azure-func-fastapi-oauth2. You can run `az config param-persist off` to turn it off.
Your preference of --name: fastapi-weather is now saved as persistent parameter. To learn more, type in `az config param-persist --help`
{
"availabilityState": "Normal",
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"clientCertExclusionPaths": null,
"clientCertMode": "Required",
"cloningInfo": null,
"containerSize": 0,
"customDomainVerificationId": "9E554ED18C55FC8B7DF988BE370BD8CE4F9DF24E108EC95811DBBD9DC751ACB3",
"dailyMemoryTimeQuota": 0,
"defaultHostName": "fastapi-weather.azurewebsites.net",
"enabled": true,
"enabledHostNames": [
"fastapi-weather.azurewebsites.net",
"fastapi-weather.scm.azurewebsites.net"
],
"extendedLocation": null,
"hostNameSslStates": [
{
"hostType": "Standard",
"ipBasedSslResult": null,
"ipBasedSslState": "NotConfigured",
"name": "fastapi-weather.azurewebsites.net",
"sslState": "Disabled",
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"virtualIp": null
},
{
"hostType": "Repository",
"ipBasedSslResult": null,
"ipBasedSslState": "NotConfigured",
"name": "fastapi-weather.scm.azurewebsites.net",
"sslState": "Disabled",
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"virtualIp": null
}
],
"hostNames": [
"fastapi-weather.azurewebsites.net"
],
"hostNamesDisabled": false,
"hostingEnvironmentProfile": null,
"httpsOnly": false,
"hyperV": false,
"id": "/subscriptions/60bc35fa-1ed3-4db3-b577-8de507555faa/resourceGroups/wiki-azure-func-fastapi-oauth2-rg/providers/Microsoft.Web/sites/fastapi-weather",
"identity": null,
"inProgressOperationId": null,
"isDefaultContainer": null,
"isXenon": false,
"keyVaultReferenceIdentity": "SystemAssigned",
"kind": "functionapp,linux",
"lastModifiedTimeUtc": "2022-11-13T22:11:44.980000",
"location": "canadaeast",
"maxNumberOfWorkers": null,
"name": "fastapi-weather",
"outboundIpAddresses": "52.242.22.213,52.242.17.182,52.242.22.49,52.242.16.79,52.242.23.165",
"possibleOutboundIpAddresses": "52.242.22.213,52.242.17.182,52.242.22.49,52.242.16.79,52.242.23.165,52.235.57.241,52.235.20.4",
"publicNetworkAccess": null,
"redundancyMode": "None",
"repositorySiteName": "fastapi-weather",
"reserved": true,
"resourceGroup": "wiki-azure-func-fastapi-oauth2-rg",
"scmSiteAlsoStopped": false,
"serverFarmId": "/subscriptions/60bc35fa-1ed3-4db3-b577-8de507555faa/resourceGroups/wiki-azure-func-fastapi-oauth2-rg/providers/Microsoft.Web/serverfarms/CanadaEastLinuxDynamicPlan",
"siteConfig": {
"acrUseManagedIdentityCreds": false,
"acrUserManagedIdentityId": null,
"alwaysOn": false,
"antivirusScanEnabled": null,
"apiDefinition": null,
"apiManagementConfig": null,
"appCommandLine": null,
"appSettings": null,
"autoHealEnabled": null,
"autoHealRules": null,
"autoSwapSlotName": null,
"azureMonitorLogCategories": null,
"azureStorageAccounts": null,
"connectionStrings": null,
"cors": null,
"customAppPoolIdentityAdminState": null,
"customAppPoolIdentityTenantState": null,
"defaultDocuments": null,
"detailedErrorLoggingEnabled": null,
"documentRoot": null,
"elasticWebAppScaleLimit": null,
"experiments": null,
"fileChangeAuditEnabled": null,
"ftpsState": null,
"functionAppScaleLimit": 0,
"functionsRuntimeScaleMonitoringEnabled": null,
"handlerMappings": null,
"healthCheckPath": null,
"http20Enabled": false,
"http20ProxyFlag": null,
"httpLoggingEnabled": null,
"ipSecurityRestrictions": [
{
"action": "Allow",
"description": "Allow all access",
"headers": null,
"ipAddress": "Any",
"name": "Allow all",
"priority": 2147483647,
"subnetMask": null,
"subnetTrafficTag": null,
"tag": null,
"vnetSubnetResourceId": null,
"vnetTrafficTag": null
}
],
"ipSecurityRestrictionsDefaultAction": null,
"javaContainer": null,
"javaContainerVersion": null,
"javaVersion": null,
"keyVaultReferenceIdentity": null,
"limits": null,
"linuxFxVersion": "",
"loadBalancing": null,
"localMySqlEnabled": null,
"logsDirectorySizeLimit": null,
"machineKey": null,
"managedPipelineMode": null,
"managedServiceIdentityId": null,
"metadata": null,
"minTlsCipherSuite": null,
"minTlsVersion": null,
"minimumElasticInstanceCount": 0,
"netFrameworkVersion": null,
"nodeVersion": null,
"numberOfWorkers": 1,
"phpVersion": null,
"powerShellVersion": null,
"preWarmedInstanceCount": null,
"publicNetworkAccess": null,
"publishingPassword": null,
"publishingUsername": null,
"push": null,
"pythonVersion": null,
"remoteDebuggingEnabled": null,
"remoteDebuggingVersion": null,
"requestTracingEnabled": null,
"requestTracingExpirationTime": null,
"routingRules": null,
"runtimeADUser": null,
"runtimeADUserPassword": null,
"scmIpSecurityRestrictions": [
{
"action": "Allow",
"description": "Allow all access",
"headers": null,
"ipAddress": "Any",
"name": "Allow all",
"priority": 2147483647,
"subnetMask": null,
"subnetTrafficTag": null,
"tag": null,
"vnetSubnetResourceId": null,
"vnetTrafficTag": null
}
],
"scmIpSecurityRestrictionsDefaultAction": null,
"scmIpSecurityRestrictionsUseMain": null,
"scmMinTlsVersion": null,
"scmType": null,
"sitePort": null,
"storageType": null,
"supportedTlsCipherSuites": null,
"tracingOptions": null,
"use32BitWorkerProcess": null,
"virtualApplications": null,
"vnetName": null,
"vnetPrivatePortsCount": null,
"vnetRouteAllEnabled": null,
"webSocketsEnabled": null,
"websiteTimeZone": null,
"winAuthAdminState": null,
"winAuthTenantState": null,
"windowsFxVersion": null,
"xManagedServiceIdentityId": null
},
"slotSwapStatus": null,
"state": "Running",
"storageAccountRequired": false,
"suspendedTill": null,
"tags": null,
"targetSwapSlot": null,
"trafficManagerHostNames": null,
"type": "Microsoft.Web/sites",
"usageState": "Normal",
"virtualNetworkSubnetId": null,
"vnetContentShareEnabled": false,
"vnetImagePullEnabled": false,
"vnetRouteAllEnabled": false
}
func azure functionapp publish fastapi-weather
Getting site publishing info...
Removing WEBSITE_CONTENTAZUREFILECONNECTIONSTRING app setting (DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=apisto;AccountKey=s/5Sk9pVi1SWAw/eqMdtFVFAD6K2rmgTU0h05l2my0kTU/mahrz81PEBRS51UuVH4xAuAD+0Qh8R+AStFaDR2g==)
Removing WEBSITE_CONTENTSHARE app setting (fastapi-weather5ccbcd995289)
Creating archive for current directory...
Performing remote build for functions project.
Uploading 13.82 MB [##############################################################################]
Remote build in progress, please wait...
Updating submodules.
Preparing deployment for commit id '9c6990db-8'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /tmp/zipdeploy/extracted
Running oryx build...
Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9.7 -p packagedir=.python_packages/lib/site-packages
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues
Oryx Version: 0.2.20210120.1, Commit: 66c7820d7df527aaffabd2563a49ad57930999c9, ReleaseTagName: 20210120.1
Build Operation ID: |5ktDlkAU04U=.84c8c23a_
Repository Commit : 9c6990db-85d9-4f87-912e-0b714dcb95c1
Detecting platforms...
Detected following platforms:
python: 3.9.7
Version '3.9.7' of platform 'python' is not installed. Generating script to install it...
Source directory : /tmp/zipdeploy/extracted
Destination directory: /home/site/wwwroot
Downloading and extracting 'python' version '3.9.7' to '/tmp/oryx/platforms/python/3.9.7'...
Downloaded in 2 sec(s).
Verifying checksum...
Extracting contents...
Done in 8 sec(s).
Python Version: /tmp/oryx/platforms/python/3.9.7/bin/python3.9
Running pip install...
[22:14:55+0000] Collecting azure-functions
[22:14:55+0000] Downloading azure_functions-1.12.0-py3-none-any.whl (160 kB)
[22:14:55+0000] Collecting fastapi
[22:14:55+0000] Downloading fastapi-0.87.0-py3-none-any.whl (55 kB)
[22:14:56+0000] Collecting fastapi_microsoft_identity
[22:14:56+0000] Downloading fastapi_microsoft_identity-0.1.6-py3-none-any.whl (7.3 kB)
[22:14:56+0000] Collecting starlette==0.21.0
[22:14:56+0000] Downloading starlette-0.21.0-py3-none-any.whl (64 kB)
[22:14:56+0000] Collecting pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2
[22:14:56+0000] Downloading pydantic-1.10.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.2 MB)
[22:14:57+0000] Collecting requests
[22:14:57+0000] Downloading requests-2.28.1-py3-none-any.whl (62 kB)
[22:14:58+0000] Collecting pytest
[22:14:58+0000] Downloading pytest-7.2.0-py3-none-any.whl (316 kB)
[22:14:59+0000] Collecting multidict
[22:14:59+0000] Downloading multidict-6.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (114 kB)
[22:14:59+0000] Collecting httpx
[22:14:59+0000] Downloading httpx-0.23.0-py3-none-any.whl (84 kB)
[22:14:59+0000] Collecting python-jose
[22:14:59+0000] Downloading python_jose-3.3.0-py2.py3-none-any.whl (33 kB)
[22:14:59+0000] Collecting typing-extensions>=3.10.0; python_version < "3.10"
[22:14:59+0000] Downloading typing_extensions-4.4.0-py3-none-any.whl (26 kB)
[22:15:00+0000] Collecting anyio<5,>=3.4.0
[22:15:00+0000] Downloading anyio-3.6.2-py3-none-any.whl (80 kB)
[22:15:00+0000] Collecting certifi>=2017.4.17
[22:15:00+0000] Downloading certifi-2022.9.24-py3-none-any.whl (161 kB)
[22:15:00+0000] Collecting idna<4,>=2.5
[22:15:00+0000] Downloading idna-3.4-py3-none-any.whl (61 kB)
[22:15:00+0000] Collecting charset-normalizer<3,>=2
[22:15:00+0000] Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
[22:15:00+0000] Collecting urllib3<1.27,>=1.21.1
[22:15:00+0000] Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
[22:15:01+0000] Collecting tomli>=1.0.0; python_version < "3.11"
[22:15:01+0000] Downloading tomli-2.0.1-py3-none-any.whl (12 kB)
[22:15:01+0000] Collecting attrs>=19.2.0
[22:15:01+0000] Downloading attrs-22.1.0-py2.py3-none-any.whl (58 kB)
[22:15:01+0000] Collecting iniconfig
[22:15:01+0000] Downloading iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
[22:15:01+0000] Collecting packaging
[22:15:01+0000] Downloading packaging-21.3-py3-none-any.whl (40 kB)
[22:15:01+0000] Collecting pluggy<2.0,>=0.12
[22:15:01+0000] Downloading pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
[22:15:01+0000] Collecting exceptiongroup>=1.0.0rc8; python_version < "3.11"
[22:15:01+0000] Downloading exceptiongroup-1.0.1-py3-none-any.whl (12 kB)
[22:15:01+0000] Collecting rfc3986[idna2008]<2,>=1.3
[22:15:01+0000] Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)
[22:15:01+0000] Collecting httpcore<0.16.0,>=0.15.0
[22:15:01+0000] Downloading httpcore-0.15.0-py3-none-any.whl (68 kB)
[22:15:02+0000] Collecting sniffio
[22:15:02+0000] Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)
[22:15:02+0000] Collecting pyasn1
[22:15:02+0000] Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
[22:15:02+0000] Collecting ecdsa!=0.15
[22:15:02+0000] Downloading ecdsa-0.18.0-py2.py3-none-any.whl (142 kB)
[22:15:02+0000] Collecting rsa
[22:15:02+0000] Downloading rsa-4.9-py3-none-any.whl (34 kB)
[22:15:02+0000] Collecting pyparsing!=3.0.5,>=2.0.2
[22:15:02+0000] Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
[22:15:02+0000] Collecting h11<0.13,>=0.11
[22:15:02+0000] Downloading h11-0.12.0-py3-none-any.whl (54 kB)
[22:15:02+0000] Collecting six>=1.9.0
[22:15:03+0000] Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
[22:15:03+0000] Installing collected packages: azure-functions, typing-extensions, sniffio, idna, anyio, starlette, pydantic, fastapi, certifi, charset-normalizer, urllib3, requests, tomli, attrs, iniconfig, pyparsing, packaging, pluggy, exceptiongroup, pytest, multidict, rfc3986, h11, httpcore, httpx, pyasn1, six, ecdsa, rsa, python-jose, fastapi-microsoft-identity
[22:15:08+0000] Successfully installed anyio-3.6.2 attrs-22.1.0 azure-functions-1.12.0 certifi-2022.9.24 charset-normalizer-2.1.1 ecdsa-0.18.0 exceptiongroup-1.0.1 fastapi-0.87.0 fastapi-microsoft-identity-0.1.6 h11-0.12.0 httpcore-0.15.0 httpx-0.23.0 idna-3.4 iniconfig-1.1.1 multidict-6.0.2 packaging-21.3 pluggy-1.0.0 pyasn1-0.4.8 pydantic-1.10.2 pyparsing-3.0.9 pytest-7.2.0 python-jose-3.3.0 requests-2.28.1 rfc3986-1.5.0 rsa-4.9 six-1.16.0 sniffio-1.3.0 starlette-0.21.0 tomli-2.0.1 typing-extensions-4.4.0 urllib3-1.26.12
WARNING: You are using pip version 20.2.3; however, version 22.3.1 is available.
You should consider upgrading via the '/tmp/oryx/platforms/python/3.9.7/bin/python3.9 -m pip install --upgrade pip' command.
Done in 14 sec(s).
Preparing output...
Copying files to destination directory '/home/site/wwwroot'...
Done in 2 sec(s).
Removing existing manifest file
Creating a manifest file...
Manifest file created.
Done in 24 sec(s).
Running post deployment command(s)...
Generating summary of Oryx build
Deployment Log file does not exist in /tmp/oryx-build.log
The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
Triggering recycle (preview mode disabled).
Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
To check our service limit, please visit https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
Writing the artifacts to a squashfs file
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on /home/site/artifacts/functionappartifact.squashfs, block size 131072.
[=============================================================|] 4768/4768 100%
Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments, compressed xattrs
duplicates are removed
Filesystem size 26496.37 Kbytes (25.88 Mbytes)
26.97% of uncompressed filesystem size (98256.02 Kbytes)
Inode table size 47595 bytes (46.48 Kbytes)
29.54% of uncompressed inode table size (161140 bytes)
Directory table size 45841 bytes (44.77 Kbytes)
36.50% of uncompressed directory table size (125596 bytes)
Number of duplicate files found 1051
Number of inodes 4970
Number of files 4424
Number of fragments 267
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 546
Number of ids (unique uids + gids) 1
Number of uids 1
root (0)
Number of gids 1
root (0)
Creating placeholder blob for linux consumption function app...
SCM_RUN_FROM_PACKAGE placeholder blob scm-latest-fastapi-weather.zip located
Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
Resetting all workers for fastapi-weather.azurewebsites.net
Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
Remote build succeeded!
Syncing triggers...
Functions in fastapi-weather:
weather - [httpTrigger]
Invoke url: https://fastapi-weather.azurewebsites.net/{*route}
Verify in Azure
Set the url: https://fastapi-weather.azurewebsites.net/weather/Paris
We need to get an access token
Fill the fields with appropriate information and generate a new token
A browser will open asking identification
An access token has been provide
you can see the detail of this access token https://jwt.ms/
Execute the Get request