Prerequisites
Before you begin, ensure you have:- An active Azure account (sign up for free)
- Azure Functions Core Tools installed
- Node.js 14.x or later
- An OpenAI API key with access to DALL-E 3 and GPT-3.5
You can also use the Azure extension in VS Code to log in and deploy functions directly from the editor.
Create Azure resources
1
Create a resource group
Create a new resource group to organize your VisionaryAI resources:
2
Create a storage account
Create an Azure Storage account for blob storage and function app storage:
3
Create a blob container
Create a container named
images to store generated DALL-E images:4
Create a Function App
Create an Azure Function App to host your serverless functions:
5
Retrieve storage credentials
Get your storage account name and key for configuration:Save these values for the next step.
Configure environment variables
Set up the required environment variables in your Function App:Deploy functions
1
Navigate to the Azure directory
2
Install dependencies
3
Deploy to Azure
Deploy your functions to the Function App:
The deployment process will bundle all functions and dependencies, then upload them to your Azure Function App.
4
Verify deployment
List your deployed functions:You should see:
generateImagegenerateSASTokengetChatGPTSuggestiongetImages
Test your deployment
Once deployed, test your functions using the Azure Portal or CLI:Update your Next.js configuration
Update your Next.js application to use the deployed Azure Functions:Monitor your functions
View logs and monitor function execution in the Azure Portal:- Navigate to your Function App
- Select Monitor > Logs
- Enable Application Insights for detailed telemetry
Application Insights is configured in
host.json with sampling enabled to reduce costs while maintaining visibility.