This message was deleted.
# azure
s
This message was deleted.
b
can you share some example code for this?
b
Here is a shortened (and slightly adjusted) version of my original code:
Copy code
def create_function_app(eventhub_resource):
	# Get all the parameters...

	# Set new access key with limited permissions
    eventhub_access_key = azure_native.eventhub.NamespaceAuthorizationRule('eventgateway_eventhub_access_rule',
        authorization_rule_name='function_app_access',
        namespace_name=param_event_hub_namespace_name,
        resource_group_name=param_rg,
        rights=["Listen", "Send"],
        opts=ResourceOptions(parent=eventhub_resource)
    )

	# Get connection string belonging to new access key
    eventhub_ns_keys = azure_native.eventhub.list_namespace_keys(
            namespace_name=param_event_hub_namespace_name, 
            resource_group_name=param_rg,
            authorization_rule_name=eventhub_access_key.name,
            opts=InvokeOptions(parent=eventhub_access_key)
            )
        )

    eventhub_conn_string = eventhub_ns_keys.primary_connection_string

    # Create Function App
    function_app_resource = web.WebApp(
        "FunctionAppResource",
        name=param_app_service_name,
        kind='functionapp,linux',
        location=param_location,
        redundancy_mode=param_redundancy_mode,
        resource_group_name=param_rg,
        site_config=web.SiteConfigArgs(
            app_settings=[
                web.NameValuePairArgs(name='FUNCTIONS_WORKER_RUNTIME', value='python'),
                web.NameValuePairArgs(name='EVENT_HUB_CONN_STR', value=eventhub_conn_string),
                web.NameValuePairArgs(name='FUNCTIONS_EXTENSION_VERSION', value='~3'),
                web.NameValuePairArgs(name='AzureWebJobsStorage', value=stor_acc_conn_string)
            ],
            linux_fx_version='python|{}'.format(param_python_version),
            python_version=param_python_version
        ),
        opts=ResourceOptions(parent=eventhub_resource, depends_on=[eventhub_ns_keys, eventhub_access_key])
    )