<@ULVA73B9P> I configured Azure PostgreSQL databas...
# ask-marvin
p
@Marvin I configured Azure PostgreSQL database as per your instructions but I get the error "ModuleNotFoundError: No module named 'psycopg2'". What's up with that?
m
thought for 5.7 seconds
Ah, the classic missing database driver situation. This is a straightforward fix - you just need to install the PostgreSQL database driver that Prefect requires. Run this command in your environment:
Copy code
bash
pip install psycopg2-binary
If you're using a requirements.txt or similar dependency management, you can add
psycopg2-binary
to it. If you run into issues installing
psycopg2-binary
(particularly on Windows), you might need to install
psycopg2
instead:
Copy code
bash
pip install psycopg2
Note that
psycopg2
might require additional system-level dependencies (like PostgreSQL client libraries) to compile, which is why the
-binary
version is generally recommended. After installing either package, your Azure PostgreSQL connection should work properly. The error you're seeing is simply Python telling you it can't find the required database driver - it's not a Prefect-specific issue, but rather a Python package dependency that needs to be satisfied. Let me know if you run into any other issues after installing the driver!
p
@Marvin How do I do this when running the prefect3 container from Docker in an Azure App Service?
m
thought for 27.3 seconds
Here's how to add psycopg2 to your Prefect container in Azure App Service: 1. Create a custom Dockerfile that extends the official Prefect image:
Copy code
dockerfile
FROM prefecthq/prefect:3-latest

# Install system dependencies required for psycopg2
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

# Install psycopg2
RUN pip install psycopg2-binary
2. Build and push this custom image to a container registry (like Azure Container Registry):
Copy code
bash
# Build the image
docker build -t <http://your-registry.azurecr.io/prefect-custom:latest|your-registry.azurecr.io/prefect-custom:latest> .

# Push to Azure Container Registry
docker push <http://your-registry.azurecr.io/prefect-custom:latest|your-registry.azurecr.io/prefect-custom:latest>
3. Update your Azure App Service configuration to use this custom image instead of the default Prefect image. If you're using Azure App Service's configuration in the Azure Portal: - Go to your App Service - Navigate to "Configuration" → "General settings" - Update the "Image source" to point to your custom image in Azure Container Registry Alternatively, if you're using Infrastructure as Code (like Azure CLI or ARM templates), update the container image reference in your deployment configuration. Remember to: - Ensure your Azure App Service has access to your Azure Container Registry (you may need to configure registry credentials) - Set any necessary environment variables in your App Service configuration, including your Prefect API key - Configure the appropriate startup command if you've modified it from the default Prefect container Let me know if you need help with any of these specific steps!
p
@Marvin what is the difference between the "prefecthq/prefect" and "prefecthq/server" container images on Docker Hub?
m
thought for 30.0 seconds
The two Docker images serve distinctly different purposes: `prefecthq/prefect`: - This is the runtime image used for executing Prefect flows - Contains the Prefect Python package and its dependencies - Used when you want to run flows in containers - Commonly used in deployment scenarios where you're containerizing your flow code - Available with different Python versions via tags (e.g.,
prefecthq/prefect:3-python3.11
) `prefecthq/server`: - This is specifically for running a self-hosted Prefect server - Contains the Prefect server application that manages flow runs, schedules, and provides the UI - Used when you want to host your own Prefect instance instead of using Prefect Cloud - Includes the API server and UI components - Typically requires additional configuration like database settings and API URL To put it in perspective: - If you're writing and running flows, you'll use
prefecthq/prefect
- If you're setting up your own Prefect infrastructure (instead of using Prefect Cloud), you'll use
prefecthq/server
In a self-hosted setup, you might actually use both: -
prefecthq/server
to run your Prefect server instance -
prefecthq/prefect
in your flow deployments to run the actual workflows This separation of concerns allows for flexible deployment architectures where the server and flow execution can be scaled independently.
p
@Marvin When hosting the "prefecthq/server" container image in an Azure App Service, how do you configure it to use an Azure Database for PostgreSQL Flexible Server for its backend?
m
thought for 32.5 seconds
Here's how to configure the Prefect server container to use Azure PostgreSQL Flexible Server in Azure App Service: 1. First, in your Azure App Service configuration, you need to set the following environment variables:
Copy code
PREFECT_SERVER_DATABASE_CONNECTION_URL=<postgresql+asyncpg://username:password@your-server-name.postgres.database.azure.com:5432/your-database-name>
Replace the components with your actual Azure PostgreSQL Flexible Server details: - `username`: Your database username - `password`: Your database password - `your-server-name`: Your Azure PostgreSQL server name - `your-database-name`: Your database name (often 'prefect' by default) 2. Make sure SSL is enabled (required for Azure PostgreSQL) by adding these environment variables:
Copy code
PREFECT_SERVER_DATABASE_SSL_MODE=require
3. Additional recommended environment variables for the server:
Copy code
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=8080
WEBSITES_PORT=8080
4. In Azure Portal: - Go to your App Service - Navigate to "Configuration" → "Application settings" - Add each of these as new application settings - Make sure to click "Save" after adding the settings 5. For the container configuration in App Service: - Set the image to
prefecthq/server:3-latest
- Ensure port 8080 is exposed (this is typically handled automatically) 6. Important security considerations: - Use Azure Key Vault to store the database connection string and retrieve it securely - Configure a managed identity for your App Service to access Key Vault - Ensure your Azure PostgreSQL server's firewall rules allow connections from your App Service Example using Key Vault reference in App Service configuration:
Copy code
PREFECT_SERVER_DATABASE_CONNECTION_URL=@Microsoft.KeyVault(SecretUri=<https://your-keyvault.vault.azure.net/secrets/prefect-db-url/version>)
7. Database initialization: - The Prefect server will automatically initialize the database schema on first startup - If you need to manually trigger database initialization, you can do so by setting the environment variable
PREFECT_SERVER_DATABASE_MIGRATE_ON_START=true
Common issues to watch for: - Make sure the database user has sufficient permissions to create tables and indexes - Verify that your Azure PostgreSQL server's firewall allows connections from Azure services - Check that the connection string format exactly matches the example above, including the
postgresql+asyncpg://
prefix - Ensure your database user password doesn't contain special characters that need URL encoding If you need to troubleshoot database connectivity: 1. Check App Service logs in "App Service logs" → "Log stream" 2. Look for any database-related error messages in the startup logs 3. Verify the connection string is correctly set in the application settings 4. Ensure the database server is accessible from the App Service's network Let me know if you need help with any specific part of this setup!
p
@Marvin How should I configure an Azure App Service to host the Prefect Server self-hosted container image?
m
thought for 65.4 seconds
Here's a comprehensive guide to configuring an Azure App Service for Prefect Server: 1. Create the App Service:
Copy code
bash
# Example Azure CLI commands
az group create --name prefect-rg --location eastus
az appservice plan create --name prefect-plan --resource-group prefect-rg --sku B1 --is-linux
az webapp create --resource-group prefect-rg --plan prefect-plan --name your-prefect-server --deployment-container-image-name prefecthq/server:3-latest
2. Configure Container Settings: In Azure Portal: - Navigate to your App Service - Go to "Configuration" → "General settings" - Set "Stack settings": - Stack:
Docker Container
- Operating System:
Linux
- Set "Container settings": - Image source:
Docker Hub
- Image and tag:
prefecthq/server:3-latest
3. Configure Required Environment Variables: Go to "Configuration" → "Application settings" and add:
Copy code
# Required Settings
WEBSITES_PORT=8080
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=8080

# If using SQLite (not recommended for production)
PREFECT_SERVER_DATABASE_CONNECTION_URL=sqlite+aiosqlite:////root/.prefect/prefect.db

# For production, use PostgreSQL (recommended)
# PREFECT_SERVER_DATABASE_CONNECTION_URL=<postgresql+asyncpg://user:password@your-postgres-server.postgres.database.azure.com:5432/prefect>
# PREFECT_SERVER_DATABASE_SSL_MODE=require

# Optional but recommended settings
PREFECT_UI_API_URL=<https://your-app-service-name.azurewebsites.net/api>
PREFECT_API_URL=<https://your-app-service-name.azurewebsites.net/api>
PREFECT_API_ENABLE_HTTP2=false
4. Configure Health Check: - Go to "Health check" - Enable health check - Set path to
/api/health
5. Configure Networking: - Go to "Networking" - Enable "Always On" to prevent the app from being unloaded - Configure any required VNet integration if needed 6. Configure Authentication (Optional but Recommended): - Go to "Authentication" - Add an identity provider (e.g., Azure AD) - Configure appropriate authentication rules 7. Configure SSL: - Go to "TLS/SSL settings" - Ensure "HTTPS Only" is enabled - Configure your SSL certificate if using a custom domain 8. Configure Monitoring: - Go to "Application Insights" - Enable application monitoring - Configure logging levels as needed 9. Scale Configuration (Production): - Go to "Scale up (App Service plan)" - Select an appropriate tier (at least P1V2 for production) - Configure auto-scaling rules if needed Important Considerations: 1. Production Requirements: - Use Premium tier (Pv2 or Pv3) for production workloads - Configure auto-scaling rules based on your workload - Use Azure Database for PostgreSQL for the backend database - Enable application insights for monitoring 2. Security Best Practices: - Use managed identities for Azure resources access - Store sensitive configuration in Azure Key Vault - Enable HTTPS only - Configure network security rules appropriately 3. Networking: - Configure VNet integration if needed - Set up private endpoints for database access - Configure appropriate firewall rules 4. Monitoring Setup: - Enable diagnostic logging - Set up alerts for critical metrics - Configure log retention policies 5. Backup and Disaster Recovery: - Enable automated backups - Configure geo-redundancy for the database - Document recovery procedures Common Issues to Watch For: - Ensure the container port (8080) matches the
WEBSITES_PORT
- Check that all environment variables are correctly set - Verify database connectivity before deployment - Monitor memory usage and adjust app service plan accordingly - Watch for cold starts if using lower tiers Let me know if you need help with any specific aspect of this configuration!
p
@Marvin I followed those instructions but I get a "ModuleNotFoundError: No module named 'psycopg2'" error in the Azure App Service log stream.
m
thought for 9.1 seconds
Ah, just like with the runtime container, we need to create a custom Docker image for the server that includes the PostgreSQL driver. Here's how to solve this: 1. Create a new Dockerfile:
Copy code
dockerfile
FROM prefecthq/server:3-latest

# Install system dependencies required for psycopg2
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

# Install psycopg2
RUN pip install psycopg2-binary
2. Build and push this custom image to Azure Container Registry (ACR):
Copy code
bash
# Build the image
docker build -t <http://your-registry.azurecr.io/prefect-server:latest|your-registry.azurecr.io/prefect-server:latest> .

# Push to Azure Container Registry
docker push <http://your-registry.azurecr.io/prefect-server:latest|your-registry.azurecr.io/prefect-server:latest>
3. Update your App Service configuration to use this custom image: - Go to your App Service in Azure Portal - Navigate to "Configuration" → "General settings" - Under "Container settings": - Change "Image source" to "Azure Container Registry" - Select your ACR - Update the image name to your custom image:
prefect-server:latest
4. Make sure your App Service has access to your ACR: - Either configure admin credentials in the App Service configuration - Or (recommended) use Managed Identity: - Enable system-assigned managed identity for your App Service - Grant the AcrPull role to this identity in your ACR If you're using Azure CLI, you can configure the App Service to use your custom image like this:
Copy code
bash
az webapp config container set \
    --name your-app-service-name \
    --resource-group your-resource-group \
    --docker-custom-image-name <http://your-registry.azurecr.io/prefect-server:latest|your-registry.azurecr.io/prefect-server:latest> \
    --docker-registry-server-url <https://your-registry.azurecr.io>
After making these changes, restart your App Service and check the logs again. The PostgreSQL driver error should be resolved. Remember to keep your custom image updated when new versions of the Prefect server image are released by rebuilding your custom image from the latest base image.
p
@Marvin "prefecthq/server:3-latest" is not a valid tag
m
thought for 62.2 seconds
You're right - let me check the actual image on Docker Hub. Looking at https://hub.docker.com/r/prefecthq/server/tags, here's the corrected Dockerfile:
Copy code
dockerfile
FROM prefecthq/server:2024.01.12

# Install system dependencies required for psycopg2
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

# Install psycopg2
RUN pip install psycopg2-binary
The key difference is using the actual date-based tag
2024.01.12
instead of the non-existent
3-latest
tag. Prefect Server uses date-based versioning for its Docker images. The rest of the process remains the same: 1. Build and push this custom image to your Azure Container Registry 2. Update your App Service to use this custom image 3. Restart the App Service This should resolve the psycopg2 module error. Let me know if you need any clarification or run into other issues!
p
@Marvin can I use "prefecthq/server:latest" instead? Is that the same as "2024.01.12"?
m
thought for 39.8 seconds
Yes, you can use
prefecthq/server:latest
, but there are important considerations: Pros of using `latest`: - Always gets the most recent stable release - Simpler to specify - Includes the newest features and bug fixes Cons of using `latest`: - Less predictable for production environments - Could automatically update to a new version without your explicit control - Harder to track which version you're actually running - Could potentially cause compatibility issues with clients For your specific case: 1. Development/Testing: Using
latest
is fine and can be convenient
Copy code
dockerfile
FROM prefecthq/server:latest
2. Production: Better to use a date-based tag for stability
Copy code
dockerfile
FROM prefecthq/server:2024.01.12
If you decide to use
latest
, make sure to: 1. Monitor the Prefect release notes for any breaking changes 2. Test thoroughly when rebuilding your image 3. Consider setting up alerts for when your App Service restarts (which could indicate a version change) For an Azure App Service deployment, I would actually recommend: - Use
latest
in your development/staging environments - Use a specific date-based tag in production - Set up a process to regularly review and update the production version in a controlled manner The choice ultimately depends on your needs for stability vs. staying current with updates. If you're just getting started or setting up a development environment, using
latest
is perfectly fine.
p
@Marvin The Azure App Service log stream is showing the error "Container app-prefect-pas-poc_1_002d273c didn't respond to HTTP pings on port: 8080. Failing site start." Why?
m
thought for 45.5 seconds
This error occurs because Azure App Service can't verify that your container is healthy and running. Here's how to fix it: 1. First, ensure these environment variables are correctly set in your App Service configuration:
Copy code
WEBSITES_PORT=8080
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=8080
2. Configure the health check in Azure App Service: - Go to your App Service in Azure Portal - Navigate to "Health check" in the left menu - Enable health check - Set the path to
/api/health
- Set "Number of unhealthy responses" to 3 or higher to allow for startup time - Click "Save" 3. Add startup time configuration: - Go to "Configuration" → "General settings" - Set "Startup Command" to:
Copy code
bash
prefect server start --host 0.0.0.0 --port 8080
4. Adjust startup time settings: - Go to "Configuration" → "General settings" - Increase "Startup Time Limit" to at least 240 seconds - Save the changes 5. Check your container logs for any startup errors: - Go to "Log stream" in the Azure Portal - Look for specific error messages during startup 6. If you're using a custom Dockerfile, make sure it exposes the correct port:
Copy code
dockerfile
FROM prefecthq/server:latest

# Install psycopg2 and dependencies
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

RUN pip install psycopg2-binary

# Explicitly expose the port
EXPOSE 8080

# Set the default command
CMD ["prefect", "server", "start", "--host", "0.0.0.0", "--port", "8080"]
7. If using Azure PostgreSQL, ensure these environment variables are set:
Copy code
PREFECT_SERVER_DATABASE_CONNECTION_URL=<postgresql+asyncpg://username:password@your-server.postgres.database.azure.com:5432/prefect>
PREFECT_SERVER_DATABASE_SSL_MODE=require
8. Additional troubleshooting steps: - Temporarily disable the health check to see if the container starts successfully - Check if the container can access the database (if using PostgreSQL) - Verify network security rules aren't blocking the health check - Look for any memory or CPU constraints that might be affecting startup If the issue persists after trying these steps, please share any specific error messages from the log stream, and I can provide more targeted assistance.
p
@Marvin How should I configure an Azure App Service to host the Prefect Server self-hosted container image using the default mysql database?
m
thought for 66.5 seconds
I need to correct a misunderstanding in your question. Prefect Server doesn't use MySQL as its default database - it uses SQLite by default, and PostgreSQL for production deployments. MySQL is not officially supported by Prefect Server. Here's how to configure Prefect Server in Azure App Service using the default SQLite database (note: this is good for testing but not recommended for production): 1. Create the App Service:
Copy code
bash
az webapp create \
    --resource-group your-resource-group \
    --plan your-app-service-plan \
    --name your-prefect-server \
    --deployment-container-image-name prefecthq/server:latest
2. Configure the required environment variables in Azure App Service:
Copy code
WEBSITES_PORT=8080
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=8080
PREFECT_UI_API_URL=<https://your-app-name.azurewebsites.net/api>
PREFECT_API_URL=<https://your-app-name.azurewebsites.net/api>
PREFECT_API_ENABLE_HTTP2=false

# SQLite configuration (default)
PREFECT_SERVER_DATABASE_CONNECTION_URL=sqlite+aiosqlite:////root/.prefect/prefect.db
3. Configure health check: - Enable health check in Azure App Service - Set path to
/api/health
- Set "Number of unhealthy responses" to 3 or higher 4. Configure container settings: - Go to "Configuration" → "General settings" - Set startup command:
Copy code
bash
prefect server start --host 0.0.0.0 --port 8080
5. Create a custom Dockerfile to ensure persistence:
Copy code
dockerfile
FROM prefecthq/server:latest

# Create directory for SQLite database
RUN mkdir -p /root/.prefect

# Make it persistent
VOLUME /root/.prefect

# Expose the port
EXPOSE 8080

# Set the default command
CMD ["prefect", "server", "start", "--host", "0.0.0.0", "--port", "8080"]
However, I strongly recommend using PostgreSQL instead of SQLite for any production deployment. Here's why: - SQLite is file-based and not suitable for container deployments - No concurrent access support - Limited scalability - Risk of data loss when containers restart - Not recommended for production workloads If you're setting up for production, I'd be happy to provide the configuration for using Azure Database for PostgreSQL instead, which would be much more robust and reliable. Would you like me to provide the PostgreSQL configuration instead? That would be the recommended approach for any serious deployment.
p
@Marvin This setup is just for testing. When I use this configuration, the app does not start and I can see an error on the App Service Log Stream, "ERROR - Container app-prefect-poc-eus2_1_b2b9efbf didn't respond to HTTP pings on port: 8080. Failing site start."
m
thought for 15.8 seconds
Let's fix the startup issue. The problem is likely related to container startup timing and health check configuration. Here's the corrected configuration: 1. First, modify your App Service configuration: Go to Azure Portal > Your App Service > Configuration > Application Settings and add these environment variables:
Copy code
WEBSITES_PORT=8080
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=8080
PREFECT_UI_API_URL=<https://your-app-name.azurewebsites.net/api>
PREFECT_API_URL=<https://your-app-name.azurewebsites.net/api>
PREFECT_API_ENABLE_HTTP2=false
PREFECT_SERVER_DATABASE_CONNECTION_URL=sqlite+aiosqlite:////root/.prefect/prefect.db

# Add these important settings
WEBSITES_CONTAINER_START_TIME_LIMIT=1800
WEBSITES_ENABLE_APP_SERVICE_STORAGE=true
2. Create a custom Dockerfile that includes proper startup handling:
Copy code
dockerfile
FROM prefecthq/server:latest

# Create directory for SQLite database with proper permissions
RUN mkdir -p /root/.prefect && \
    chmod 777 /root/.prefect

# Install curl for health check
RUN apt-get update && \
    apt-get install -y curl && \
    rm -rf /var/lib/apt/lists/*

# Create a startup script
COPY startup.sh /
RUN chmod +x /startup.sh

# Expose the port
EXPOSE 8080

# Use the startup script as the entry point
CMD ["/startup.sh"]
3. Create a
startup.sh
script in the same directory as your Dockerfile:
Copy code
bash
#!/bin/bash

# Start Prefect server in the background
prefect server start --host 0.0.0.0 --port 8080 &

# Store the PID of the server
SERVER_PID=$!

# Wait for the server to be ready
echo "Waiting for Prefect server to start..."
for i in {1..30}; do
    if curl -s <http://localhost:8080/api/health> > /dev/null; then
        echo "Prefect server is ready!"
        # Keep the container running
        wait $SERVER_PID
        exit 0
    fi
    echo "Attempt $i: Server not ready yet, waiting..."
    sleep 5
done

echo "Server failed to start within timeout"
exit 1
4. Build and push this custom image to Azure Container Registry:
Copy code
bash
# Build the image
docker build -t <http://your-registry.azurecr.io/prefect-server:test|your-registry.azurecr.io/prefect-server:test> .

# Push to ACR
docker push <http://your-registry.azurecr.io/prefect-server:test|your-registry.azurecr.io/prefect-server:test>
5. In Azure Portal, configure the health check: - Go to your App Service - Find "Health check" in the left menu - Enable health check - Path:
/api/health
- Number of unhealthy responses: 10 (to give more time for startup) - Save the changes 6. Important: Remove any custom "Startup Command" if you previously set one in the App Service configuration. 7. Configure container settings: - Go to "Configuration" → "General settings" - Make sure "Always On" is enabled - Set "Startup Time Limit" to at least 240 seconds These changes should resolve the startup issues by: - Giving the container more time to start - Properly handling the health check - Ensuring the SQLite directory is properly created and accessible - Using a startup script to verify the server is actually running If you still see issues, check the log stream for specific error messages. The startup script will now provide more detailed information about what's happening during the startup process. Let me know if you need any clarification or if you're still seeing issues!
p
@Marvin what port does the prefect server listen on when running in a Linux container?
m
thought for 30.5 seconds
I need to correct my previous responses. The Prefect Server in a Linux container listens on port 4200 by default, not 8080 as I incorrectly suggested earlier. Here's the corrected configuration for Azure App Service: 1. Environment Variables:
Copy code
WEBSITES_PORT=4200
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=4200
PREFECT_UI_API_URL=<https://your-app-name.azurewebsites.net/api>
PREFECT_API_URL=<https://your-app-name.azurewebsites.net/api>
PREFECT_API_ENABLE_HTTP2=false
2. Health Check Configuration: - Path:
/api/health
- Port: 4200 3. Dockerfile:
Copy code
dockerfile
FROM prefecthq/server:latest

# Create directory for SQLite database with proper permissions
RUN mkdir -p /root/.prefect && \
    chmod 777 /root/.prefect

# Expose the correct port
EXPOSE 4200

# Default command
CMD ["prefect", "server", "start", "--host", "0.0.0.0", "--port", "4200"]
This should resolve the HTTP ping issues you were seeing, as Azure App Service was checking port 8080 when the server was actually listening on 4200. Let me know if you need any clarification or run into other issues!
p
@Marvin If I add Microsoft Entra ID authentication to the Azure App Service running the Prefect Server container, do I need to add configuration to the Azure Container Instance worker pool configuration to allow it to call the Prefect Server API?
m
thought for 43.1 seconds
Yes, when you enable Microsoft Entra ID (formerly Azure AD) authentication on the App Service hosting your Prefect Server, you will need to configure additional authentication settings in your Azure Container Instance (ACI) work pool configuration. This ensures the worker can authenticate against the secured Prefect Server API. Here's what you need to do: 1. First, ensure your Azure App Service is properly configured with Entra ID authentication. 2. In your ACI work pool configuration, you'll need to add the following environment variables:
Copy code
yaml
variables:
  PREFECT_API_KEY: "${PREFECT_API_KEY}"
  PREFECT_API_URL: "<https://your-app-service-url>"
3. You have two main options for authentication: - Use a Prefect API key (recommended) - Configure managed identity for the ACI instances The simplest approach is using a Prefect API key. Create an API key in your Prefect Server, then provide it to your work pool configuration through a secure mechanism like Azure Key Vault or environment variables. If you prefer using managed identities: 1. Create a managed identity for your ACI instances 2. Grant it appropriate permissions in your Entra ID configuration 3. Configure the work pool to use this managed identity For security best practices and detailed configuration steps, refer to: - https://docs-3.prefect.io/v3/how-to-guides/deployment_infra/serverless - https://docs-3.prefect.io/integrations/prefect-azure/aci_worker Keep in mind that the specific configuration might vary depending on your security requirements and Azure environment setup. If you need help with a particular authentication method, I can provide more detailed guidance.