Dewiride DevBlogs

website·Indexed 31 days ago

https://devblogs.dewiride.com

A technical blog featuring guides and troubleshooting for a wide range of developer tools and platforms, including Microsoft Azure, .NET, C#, Next.js, Docker, Linux (Ubuntu), and Power Platform. Topics cover cloud computing, identity management (IAM, RBAC), security, database management with Entity Framework Core, and DevOps practices.

Tokens
82.8K
Snippets
319
Records
607
Agent score
54%

What's inside Dewiride DevBlogs

  1. Overview of Microsoft Foundry

    Microsoft Foundry is a unified Azure resource that integrates agents, models, and tools. It provides a single point for shared role-based access control (RBAC), networking, policies, tracing, and evaluations.

    Technically, a Foundry resource is an Azure resource of type Microsoft.CognitiveServices/accounts with the kind property set to AIServices and project management enabled. It is backward compatible with all Azure OpenAI APIs while expanding the model catalog to include Meta, xAI, Mistral, DeepSeek, Black Forest Labs, and Microsoft models, as well as partner/community models via the Marketplace.

  2. Manage application settings using IConfiguration in .NET 10

    In ASP.NET Core applications, appsettings.json is the standard location for storing configuration settings such as connection strings, API base URLs, feature flags, and timeouts. These values are accessed via the IConfiguration service, which is automatically registered by the ASP.NET Core framework. For console applications, the configuration system must be manually instantiated.
  3. Verify image architecture and tags in ACR

    After pushing an image, verify that the correct version tag exists and that the architecture is amd64 (required for Azure Container Apps).
    # List tags for a specific repository
    az acr repository show-tags \
      --name <registry_name> \
      --repository <image_name> \
      -o table
    
    # Verify the architecture and OS of the image manifest
    az acr manifest list-metadata \
      --registry <registry_name> \
      --name <image_name> \
      --query "[].{tag:tags[0], arch:architecture, os:operatingSystem}" -o table
  4. Understand Microsoft Foundry resource and endpoint differences

    Microsoft Foundry (formerly Azure AI Studio and Azure AI Foundry) is the preferred platform for new AI work. It is compatible with Azure OpenAI but offers expanded capabilities.

    Key Concepts:

    • Resource Compatibility: Upgrading from Azure OpenAI to Foundry preserves endpoints, API keys, and API compatibility. It is a reversible process and does not increase the cost of existing usage.
    • Endpoints:
      • Azure OpenAI Endpoint: Serves OpenAI models via the Azure OpenAI API.
      • Project Endpoint: Serves the Foundry API, providing access to the full model catalog, agents, and tools.
    • Projects: A single Foundry resource can host multiple projects to isolate work, access, and data. The default project contains additional capabilities.
    • Portal Version: Use the new portal for the latest features; the 'Classic' portal is maintained for hub-based projects.
  5. Build and push multi-architecture images using Docker buildx

    When building images on ARM-based machines (like Apple Silicon Macs) for Azure, using docker push may upload the wrong architecture. Use docker buildx with the --platform flag to ensure the image is compatible with the target environment and push it in a single step.

    To produce a multi-architecture image that supports both x86 and ARM, specify multiple platforms. Note that this roughly doubles the build time.

    # Build for a specific architecture and push in one step
    docker buildx build --platform linux/amd64 -t <registry-name>.azurecr.io/<image-name>:<tag> --push
    
    # Build for multiple architectures
    docker buildx build --platform linux/amd64,linux/arm64 -t <registry-name>.azurecr.io/<image-name>:<tag> --push
  6. Backup strategies for Dewiride Analytics data stores

    Dewiride Analytics uses two different databases that require distinct backup methods because of their data shapes and storage engines. Both methods described below can be performed while the stack is running.

    StoreData HeldRecommended MethodReasonRestore Target
    PostgreSQLAccounts, websites, settings, job queuepg_dump (logical dump)Small size; restores cleanly across different versionsDifferent PostgreSQL version
    ClickHousePage views, clicks, classificationsBACKUP (server-side copy)Columnar stores make logical dumps slow and excessively largeSame major ClickHouse version
  7. Troubleshoot Azure Container App deployment errors

    Common deployment issues in Azure Container Apps often relate to port mismatches, architecture errors, or permission issues.
    | Problem | Cause | Fix |
    | :--- | :--- | :--- |
    | Gateway error (container healthy) | Target port set to 80 instead of 8080 | Set target port to 8080 |
    | exec format error in logs | Image built for wrong CPU architecture (e.g. ARM) | Rebuild with --platform linux/amd64 |
    | UNAUTHORIZED in logs | Role assignment missing | Assign AcrPull to the app's identity on the registry |
    | No registries found | Wrong subscription selected | Select the subscription that owns the registry |
    | Slow first request | Scaled to zero (cold start) | Set min-replicas to 1 |
  8. Understand Microsoft Foundry agentic vs stateless behavior

    Microsoft Foundry's default mode is agentic, meaning it automatically adds thread state, orchestration, and implicit system instructions. If migrating existing Azure OpenAI code and responses differ, this is the cause. To restore classic stateless behavior, call the Azure OpenAI endpoint directly using the original request body.
  9. Orchestrate a Weather Forecast Agent with Semantic Kernel

    The Weather Forecast Agent uses a layered architecture combining WeatherAgentBot.cs (routing), WeatherForecastAgent.cs (AI logic via ChatCompletionAgent), and specialized plugins.

    Key implementation details include:

    • Agent Instructions: Define the agent's persona and output requirements (e.g., using Adaptive Cards for forecasts).
    • Conversation History: Use ChatHistory from ITurnState to maintain context for follow-up questions.
    • Streaming Responses: Use turnContext.StreamingResponse.QueueInformativeUpdateAsync to provide real-time feedback.
    • Multi-modal Output: Handle different response types (Text vs. Adaptive Card) by checking the ContentType of the agent's response.
    // Example Agent Instructions
    private const string AgentInstructions = """
        You are a friendly assistant that helps people find a weather forecast for a given time and place.
        You may ask follow up questions until you have enough information to answer the customers question,
        but once you have a forecast, make sure to format it nicely using an adaptive card.
        You should use adaptive JSON format to display the information in a visually appealing way.
        """;
    
    // Example Response Rendering
    switch (forecastResponse.ContentType)
    {
        case WeatherForecastAgentResponseContentType.Text:
            turnContext.StreamingResponse.QueueTextChunk(forecastResponse.Content);
            break;
        case WeatherForecastAgentResponseContentType.AdaptiveCard:
            turnContext.StreamingResponse.FinalMessage = MessageFactory.Attachment(new Attachment()
            {
                ContentType = "application/vnd.microsoft.card.adaptive",
                Content = forecastResponse.Content,
            });
            break;
    }
  10. Use the Foundry Portal for model management

    The Azure portal provides only resource-level management. All model building, deployment, and agent configuration occurs in the Foundry portal. Note that there is a 'New Foundry' toggle in the top bar; 'Foundry (new)' is the current focus for investment and project-based workflows, while 'Foundry (classic)' supports older hub-based projects.
  11. Azure Container Apps Overview and Free Tier

    Azure Container Apps is a serverless container service that manages the underlying infrastructure, load balancing, HTTPS certificates, and scaling.

    Key features include:

    • Scale to Zero: Compute charges stop when there is no traffic.
    • Free Allowance: Every subscription receives a monthly free grant of 180,000 vCPU-seconds, 360,000 GiB-seconds, and 2 million HTTP requests.