Trying to set up an Azure Function as an endpoint


I am able to get the TodoGPT example to work. I want to create an Azure Function.

I can run Azure functions locally.

I’m trying this in an Az Fn.

async def openapi_spec():

I tried to create the endpoint openapi.yaml, and Azure complains name must start with a letter and can only contain letters, digits, "_" and "-".

Not sure how to get around this yet.

Thank you

Instead of the dot “.” in “openapi.yaml” - use dash “-” as in “openapi-yaml”
It is “more” Azure compliant.

Looks like your using python, just rewrite the endpoint to match what OpenAi expects and create another for what azure expects.

Something like this

import requests
import yaml

def rewrite_yaml_files(url, output_filenames):
    # Fetch the contents of the sample.yaml file from the URL
    response = requests.get(url)
    if response.status_code != 200:
        raise Exception(f"Failed to fetch file from URL: {url}")
    # Parse the YAML content
    yaml_content = yaml.safe_load(response.text)
    # Write the contents to the specified output files
    for output_filename in output_filenames:
        with open(output_filename, 'w') as outfile:
            yaml.safe_dump(yaml_content, outfile)

# Define the URL of the sample.yaml file on the /data server
url = ''

# Define the output filenames
output_filenames = ['abc.yaml', 'xyz.yaml']

# Call the function to rewrite the YAML files
rewrite_yaml_files(url, output_filenames)

Thanks! I’m looking to use C# and PowerShell.

these days Microsoft made SDK for c#

Hi, @DougFinke please advise if renaming all the instances of the endpoint in your code worked. @ruv gave you a solution feasible in Python - since I couldn’t recognize the programming language you are using, and as far as I know, Azure is something sensitive to its own “namespacing” compliance, the only thing I could think is the renaming - from a dot (.) to dash (-) - however… the problem is if the same endpoint name is used across different platforms with other naming compliances then I would try letters only, no symbols at all.

I hope this helps.

Thank you.I’m trying to build a plugin using a .NET language, PowerShell, C# or F#.

Those characters are not supported.
I tried openapi_yaml
then func start --cors * to spin it up locally.

Tried the endpoints replacing the . with - etc


Try to find the manifest from the localhost
Failed to fetch localhost manifest. Check to ensure your localhost is running and your localhost server has CORS enabled.

I can spin up the python TodoGPT example on the same box using the and it works.

Still trying to figure it out …

You are doing everything right - but when you’re trying to access a manifest file from localhost you’re encountering issues with CORS (Cross-Origin Resource Sharing). So, if the Python TodoGPT is working correctly on the same machine, it indicates that your localhost server is running, and the issue may be specific to the .NET implementation or configuration.

  1. Check your networking settings: localhost server must be accessible from your .NET language code. Check the correct hostname, port, and protocol for any misspellings.
    1.1 Does the firewall/antivirus allow the connection?
    1.2 The default port for localhost is 80 for HTTP and 443 for HTTPS may require administrative privileges to connect to some platforms
    1.3 HTTPS (443) requires SSL/TLS certificates for encryption;

  2. Check the OpenAPI specifications (openapi.yaml): they are correctly defined and adhere to the current OpenAPI specification? Incorrect or incomplete specifications may result in some issues when trying to access the manifest file;

  3. Debug your code: the .NET code, look for any issues related to CORS or the manifest file - assuming the manifest file is correctly located at the endpoint “/.well-known/ai-plugin.json” on your localhost server.

With the information you provided, it is the only thing I could think at this moment.

I hope this helps. Please advise of any changes.

Check this thread: someone got to solve CORS issues using a proxy.

Cross-Origin Resource Sharing (CORS)

Thank you, will check out these issues.

I cannot create an Azure Function endpoint with ‘.’ (same for the openapi.yaml’). I expect these will have issues, but first I’ll ensure the other items are correct.

Thank you for the clues.

Just a note, this is not an officially supported one by Microsoft.