0

I'm new to azure functions so bear with me.

I'm working on a microservice that will use a blob storage trigger and input/output bindings to process data and write to a database, but I am having trouble with the basic blob storage trigger function. For reference, I am developing in Visual Studio Code using Python with the V2 model of programming as listed in the azure documentation I have installed the Azure functions extension and the azurite extension, but in my local.settings.json I have added the connection string to the Value AzureWebJobStorage and put the Feature Flag and Storage Type.

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=REDACTED;AccountName=REDACTED;AccountKey=REDACTED;EndpointSuffix=core.windows.net",
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
    "AzureWebJobsSecretStorageType": "files",
    "FUNCTIONS_EXTENSION_VERSION": "~4",
    "APPINSIGHTS_INSTRUMENTATIONKEY": "REDACTED",
    "APPLICATIONINSIGHTS_CONNECTION_STRING": "REDACTED",
    "user":"REDACTED",
    "host":"REDACTED",
    "password":"REDACTED",
    "dbname":"REDACTED",
    "driver":"REDACTED"
  }
}

I had our architect create the necessary resources for me (gen2 Storage Account, function app), and our company has protocols in place for security, meaning the network access is disabled for the storage account and a private endpoint is configured, but not for the function App because the deployment process wouldn't work.

In my function_app.py I have this for the blob trigger.

@app.function_name(name="BlobTrigger1")
@app.blob_trigger(arg_name="myblob", path="samples-workitems/{name}",
                  connection="")
def test_function(myblob: func.InputStream):
   logging.info(f"Python blob trigger function processed blob \n"
                f"Name: {myblob.name}\n"
                f"Blob Size: {myblob.length} bytes")

Host.json

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensions": {
        "blobs": {
            "maxDegreeOfParallelism": 4
        }
    },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.15.0, 4.0.0)"
  },
  "concurrency": {
    "dynamicConcurrencyEnabled": true,
    "snapshotPersistenceEnabled": true
  }
}

When I run the app locally using

  1. Azurite: Start
  2. func host start

it spits out. enter image description here

It is also worth noting I have a util folder with simple scripts. They DO NOT FOLLOW THE BLUEPRINT SCHEMA. I don't know if this is the problem or if I can keep doing this, but then functions in them aren't meant to be azure functions, more like helper functions.

Storage account networking enter image description here

Container view enter image description here

Azure Function in the cloud. I haven't deployed to this function because it didn't work. enter image description here enter image description here

It is very frustrating because I don't know if the problem lies with the way the resource was configured or if it's my mistake with the code I wrote, the way I set this up, or if it's a simple issue with the settings in one of the Json files.

MoHaKh
  • 1
  • I can see you have disabled the public network access but have you enabled the selected network access if function app is in Virtual Network? –  Feb 08 '23 at 05:15
  • 1
    What is REDACTED which you have mentioned as a value in local.settings.json? – Pravallika KV Feb 08 '23 at 11:52
  • @PravallikaKothaveerannagari That is the sensitive information I left out, mainly info to connect to a db and connection string to the storage account – MoHaKh Feb 08 '23 at 16:02

0 Answers0