How to run .NET 8 console app on Azure Batch Node?

yuriy@mquark.com 20 Reputation points
2025-02-15T17:26:40.02+00:00

I am trying to run a custom .NET 8 app on Azure Batch Node. To do that, I need get the corresponding .NET runtime installed on the target node. While researching this problem, I found the following possible solutions:

  1. Use custom image with pre-installed .NET version. This sounds like too much pain. Is this even recommended approach? It can't be that difficult, can it?
  2. Download .NET installer, zip it, and attach as application to the Batch Account. Then have a pool level startup task to install .NET. This approach doesn't seem healthy to me though - why should I be copying around the .NET installer if it's already available online?
  3. Install it directly from https://dot.net/v1/dotnet-install.ps1 as described here. However, I am getting an error when I try:

    Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel

What is the best practice here? I am sure many folks are facing this problem. I am very surprised that Microsoft does not have a working example of how to run a Hello World .NET console apps on Azure Batch Node. Isn't it the most common scenario?

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
352 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,195 questions
0 comments No comments
{count} votes

Accepted answer
  1. Esheshwari Kumari 90 Reputation points
    2025-02-15T17:38:26.7433333+00:00

    I understand your frustration with running a .NET 8 app on Azure Batch Node. Let's explore the best practices for this scenario:

    1. Using a Custom Image: While it might seem like a lot of work initially, creating a custom image with the pre-installed .NET runtime is actually the most reliable and efficient approach. This ensures that your environment is consistent and reduces the risk of errors during deployment. You can create a custom image using Azure VM images and then use this image to create your Batch pool2.

    Application Packages: Another approach is to use Azure Batch Application Packages. You can upload a .NET installer as an application package and then configure your pool to install it during startup1. This method is cleaner than zipping and attaching the installer manually.

    Installing Directly from dot.net/v1/dotnet-install.ps1: If you encounter SSL/TLS errors, it might be due to network restrictions or proxy settings. Ensure that your nodes have internet access and can reach the dot.net URL. You can also try using a different PowerShell script or method to download and install the .NET runtime.

    Here's a step-by-step guide to using Application Packages:

    Create an Application Package: Upload the .NET installer as an application package in your Azure Batch account.

    Create a Pool with Application Packages: When creating your Batch pool, specify the application package to be installed on the nodes.

    Configure Startup Tasks: Set up a startup task in your pool to install the .NET runtime using the application package.

    This approach simplifies the process and ensures that your .NET runtime is installed correctly on all nodes.

    I hope this helps! If you have any more questions or need further assistance, feel free to ask.I understand your frustration with running a .NET 8 app on Azure Batch Node. Let's explore the best practices for this scenario:

    Using a Custom Image: While it might seem like a lot of work initially, creating a custom image with the pre-installed .NET runtime is actually the most reliable and efficient approach. This ensures that your environment is consistent and reduces the risk of errors during deployment. You can create a custom image using Azure VM images and then use this image to create your Batch pool2.

    Application Packages: Another approach is to use Azure Batch Application Packages. You can upload a .NET installer as an application package and then configure your pool to install it during startup1. This method is cleaner than zipping and attaching the installer manually.

    Installing Directly from dot.net/v1/dotnet-install.ps1: If you encounter SSL/TLS errors, it might be due to network restrictions or proxy settings. Ensure that your nodes have internet access and can reach the dot.net URL. You can also try using a different PowerShell script or method to download and install the .NET runtime.


1 additional answer

Sort by: Most helpful
  1. Esheshwari Kumari 90 Reputation points
    2025-02-15T18:46:44.5666667+00:00

    Hey! first of all i can understand the frustration regarding this issue, and yes am still a learner so may be i won't be able to help completely but let me know if this works,

    To ensure internet access on your Azure Batch pool nodes, you need to configure the pool's network settings to allow outbound access. Here's how you can do it:

    Enable Public Network Access: Make sure that public network access is enabled for your Batch account. You can do this in the Azure portal by navigating to your Batch account settings and enabling public network access2.

    Configure Pool Endpoint Settings: When creating your pool, configure the endpoint settings to allow outbound internet access. You can do this by setting up Network Address Translation (NAT) pools and Network Security Group (NSG) rules to allow traffic to the internet3.

    Here's an example of how to configure the pool endpoint settings in C#:

    C#

    using Microsoft.Azure.Batch;
    using Microsoft.Azure.Batch.Common;
    
    namespace AzureBatch
    {
        public void SetPortsPool()
        {
            pool.NetworkConfiguration = new NetworkConfiguration
            {
                EndpointConfiguration = new PoolEndpointConfiguration(new InboundNatPool[]
                {
                    new InboundNatPool("Internet", 3389, 3389, new NetworkSecurityGroupRule[]
                    {
                        new NetworkSecurityGroupRule("AllowInternet", SecurityGroupRuleAccess.AccessAllow, "Internet")
                    })
                })
            };
        }
    }
    

    This example sets up a NAT pool to allow RDP traffic from the internet and configures an NSG rule to allow internet access.

    By following these steps, you should be able to ensure that your pool nodes have internet access, which will allow you to use the dot.net/v1/dotnet-install.ps1 script without encountering TLS errors.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.