Azure Function: blobs_extension app key keeps changing

119 Views Asked by At

How can I keep the blobs_extension app key persistent so that I don't have to update the Webhook event subscription endpoint every time I restart or re-deploy a function or change any function or blob storage account settings? The app key keeps changing in an Azure Function that I am working on based on the workflow described in this link, causing the function to stop processing data. Thank you!

That mostly happens when function is stopped and restarted. For the re-deployments it mostly remains the same, so I see function running

    @FunctionName("BlobFunction")
    public void run(@BlobTrigger(name = "content", path = "%MY_PATH%", dataType = "string", connection = "StorageString", source = "EventGrid") String content,
                    @BindingName("name") String name,
                    @KafkaOutput(name = "kafkaOutput", topic = "%TOPIC%", brokerList = "%BROKER_LIST%",
                            username = "$ConnectionString",
                            password = "EventHubConnection",
                            authenticationMode = BrokerAuthenticationMode.PLAIN,
                            protocol = BrokerProtocol.SASLSSL) OutputBinding<KafkaEntity> output,
                    final ExecutionContext context) {

        final KafkaEntity kafkaMessage = new KafkaEntity(0, 0, System.getenv("TOPIC"),
                Instant.now().toString(), content, customer, new KafkaHeaders[]{new KafkaHeaders("name", name)});

        output.setValue(kafkaMessage);
    }
1

There are 1 best solutions below

0
On

The system keys are, by default, persisted through the AzureWebJobsStorage connection. If something changes there such that the system no longer sees a value to use, it will create a new one using whatever storage is available to it. But if nothing has changed for that specific connection, then we would expect no unprompted rotation to occur for a system key. In particular, an explicit stop/restart on its own is not expected to make any changes to the system state.

Can you clarify what this means? “change any function or blob storage account settings”