Hello Pulumi Team. I'm attempting to deploy a Pyth...
# azure
v
Hello Pulumi Team. I'm attempting to deploy a Python Azure Function on Linux with azure-native and I'm running into an issue - the app successfully deploys, but the
pythonVersion
is not setting, which is also preventing the appropriate linux image from deploying. I have even manually set the
linuxFxVersion
to
python|3.11
, but on deploy it is set to
python|3.6
. Are their any suggestions as to why I might be running into this issue? The app works if I set the python version manually in the console after deployment, but I can't get it to set automatically.
Copy code
assistantApiFnApp:
        type: azure-native:web:WebApp
        properties:
            name: ${resourcePrefix}-api
            resourceGroupName: ${resourceGroup.name}
            serverFarmId: ${servicePlan.id}
            kind: FunctionApp
            location: ${region}
            siteConfig:
                pythonVersion: "3.11"                   
                appSettings:
                    - name: FUNCTIONS_WORKER_RUNTIME
                      value: python
                    - name: FUNCTIONS_EXTENSION_VERSION
                      value: "~4"
                    - name: linuxFxVersion
                      value: "Python|3.11"
                    - name: AzureWebJobsStorage
                      value: DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccountKeys.keys[0].value}
                    - name: WEBSITE_RUN_FROM_PACKAGE
                      value: ${assistantApiFn.url}?${signature.serviceSasToken}
                    - name: WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
                      value: DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};AccountKey=${storageAccountKeys.keys[0].value}
                    - name: WEBSITE_CONTENTSHARE
                      value: ${fileShare.name}
                cors:
                    allowedOrigins:
                        - "*"
f
I ran into this, too. It turns out that
linuxFxVersion
needs to be directly under
siteConfig
, not under
appSettings
. Mine is in Python rather than YAML, so it looks like...
Copy code
...
    site_config={
        "app_settings": [
            {
                "name": "FUNCTIONS_WORKER_RUNTIME",
                "value": "python",
            },
            {
                "name": "FUNCTIONS_EXTENSION_VERSION",
                "value": "~4",
            },
            ...
        ],
        "linux_fx_version": "Python|3.9",
        ...
For some reason, the Azure library it imports seems to be incompatible with Python 3.11, which is why mine is set to 3.9. Haven’t figured that part out yet
v
That worked! thank you, you are a godsend. I've been fighting with that issue for the last two days.
f
I feel for you! I scratched my head for quite a while on that one, myself!