Artificial Intelligence (AI) Azure

Ollama on Windows Server 2025 on Azure User Guide

| Product: Ollama on Windows Server 2025 on Azure

Overview

Ollama is an open source server for running large language models on your own machine. It downloads and serves open models such as Llama, Gemma, Mistral, Qwen and Phi behind one REST API, which is also compatible with OpenAI's chat completions API, so applications written for OpenAI can use your own server instead.

This image runs Ollama 0.40.19 as a Windows service on Windows Server 2025 Datacenter (Desktop Experience), on CPU. The small Llama 3.2 1B model is already pulled, so the API answers as soon as first boot finishes. Ollama has no sign-in of its own, so it listens only on the VM itself (127.0.0.1:11434). In front of it, Caddy serves HTTPS on port 443 and asks for a password on every request, and port 80 only redirects to HTTPS. On the first boot of every VM the image creates a random password, a TLS certificate and an Ollama identity key of its own, so nothing is shared between machines and no default password ships. The Windows Server licence is included in the virtual machine price that Microsoft bills; Ollama is open source under the MIT licence. cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours.

What is included:

  • Ollama 0.40.19 (upstream's standalone Windows build, MIT licensed) in C:\Program Files\Ollama, running as the Windows service Ollama (startup Automatic) under its own virtual account NT SERVICE\Ollama, not LocalSystem
  • The CPU build only: upstream's NVIDIA CUDA and Vulkan GPU libraries are not included, and Ollama picks the CPU code path that suits the VM's processor
  • The starter model llama3.2:1b (Meta's Llama 3.2 1B Instruct, 1.3 GB), already pulled into C:\ProgramData\Ollama\models
  • Caddy 2.11.9 as the HTTPS front, running as the Windows service OllamaProxy (display name Ollama HTTPS (Caddy)) under NT SERVICE\OllamaProxy: HTTPS on TCP 443 with this VM's own certificate and password, answers streamed as they are generated, TCP 80 redirecting to HTTPS, and Windows Firewall rules for both ports
  • A per-VM password for the user admin, written to a file only administrators can read
  • A per-VM self signed TLS certificate for the VM's public IP address, private IP address and computer name
  • Windows Server 2025 Datacenter, patched with Windows Update at build, Microsoft Defender Antivirus and Windows Firewall on
  • cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours

Llama 3.2 is licensed under the Llama 3.2 Community License Agreement, Copyright © Meta Platforms, Inc. All Rights Reserved. Built with Llama. The licence and Meta's acceptable use policy are inside the model: ollama show --license llama3.2:1b prints them.

Prerequisites

An active Azure subscription, a Remote Desktop client, and a virtual network in the target region.

The image runs on CPU, so the VM size decides which models you can run and how fast they answer. A model needs roughly its download size in memory, plus room for Windows. Standard_B2ms (2 vCPU, 8 GiB RAM) runs the 1B starter model but slowly. On a fresh B2ms, the first chat answer, including loading the model, took 56 seconds for 64 tokens. Standard_D4s_v5 (4 vCPU, 16 GiB RAM) or larger is a better start for real use, and 7B to 8B models need at least 16 GiB. More vCPUs make answers faster.

In the network security group, allow inbound TCP 3389 (Remote Desktop), TCP 443 (the Ollama API over HTTPS) and TCP 80 (the redirect to HTTPS) from your own address ranges only.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Ollama on Windows Server 2025 by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size, and set the Administrator account username and password. Under Inbound port rules allow RDP (3389), HTTP (80) and HTTPS (443), then narrow each rule's source to your own address range on the Networking tab. Select Review + create, then Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn cloudimg1647283583153:ollama-windows-server:default:latest

az vm create \
  --resource-group <your-rg> \
  --name ollama \
  --image cloudimg1647283583153:ollama-windows-server:default:latest \
  --size Standard_D4s_v5 \
  --admin-username <admin-name> \
  --admin-password '<a strong password>' \
  --public-ip-sku Standard

az vm open-port --resource-group <your-rg> --name ollama --port 3389 --priority 1000
az vm open-port --resource-group <your-rg> --name ollama --port 443 --priority 1010
az vm open-port --resource-group <your-rg> --name ollama --port 80 --priority 1020

az vm open-port opens each port to any address; narrow the rules to your own ranges in the network security group afterwards.

First boot takes a few minutes. When the VM first starts, Windows finishes its setup. Then the image creates this VM's password, certificate and configuration and starts both services. Until then nothing answers on port 443. The setup is finished when the file C:\ProgramData\ollama-windows-server-firstboot.done exists (Step 4).

Step 3 - Connect with Remote Desktop

Connect to the VM's public IP address with your Remote Desktop client (on Windows, mstsc; on macOS, Windows App), signing in with the administrator name and password you set at deployment. Open Windows PowerShell as administrator for the commands below.

Step 4 - Confirm Ollama is running

Test-Path C:\ProgramData\ollama-windows-server-firstboot.done
Get-CimInstance Win32_Service -Filter "Name LIKE 'Ollama%'" | Format-Table Name, State, StartMode, StartName -AutoSize
Get-NetTCPConnection -State Listen -LocalPort 443, 80, 11434 | Format-Table LocalAddress, LocalPort, @{n='Process';e={(Get-Process -Id $_.OwningProcess).ProcessName}} -AutoSize
Invoke-RestMethod http://127.0.0.1:11434/api/version
True

Name        State   StartMode StartName
----        -----   --------- ---------
Ollama      Running Auto      NT SERVICE\Ollama
OllamaProxy Running Auto      NT SERVICE\OllamaProxy

LocalAddress LocalPort Process
------------ --------- -------
::                  80 caddy
::                 443 caddy
127.0.0.1        11434 ollama

version : 0.40.19

An elevated PowerShell window on a new VM: first boot done, the Ollama and OllamaProxy services running as their own accounts and starting automatically, Caddy on ports 80 and 443, Ollama on 127.0.0.1:11434 only, and the Ollama and Caddy versions

True confirms first boot finished. Both services run under their own accounts and start automatically with Windows. Only Caddy listens on the network (ports 443 and 80). Ollama itself listens on 127.0.0.1:11434, which nothing outside the VM can reach, so every request from outside passes the password check first. On the server, the ollama command talks to the service directly:

& "C:\Program Files\Ollama\ollama.exe" list
& "C:\Program Files\Ollama\caddy\caddy.exe" version
NAME           ID              SIZE      MODIFIED
llama3.2:1b    baf6a787fdff    1.3 GB    36 minutes ago
v2.11.9 h1:bhZtcRKQOq0fuLvEgCdPYvUxXyGn9kzjG4lh2332DTE=

The first boot log records what it made (the addresses are this VM's own, shown here as placeholders):

Get-Content C:\ProgramData\ollama-windows-server-firstboot.log
2026-12-02T22:10:12.0663822Z provisioning finished
2026-12-02T22:10:22.9313535Z addresses public=<public-address> private=<private-address>
2026-12-02T22:10:24.1023206Z certificate CN=<public-address> names=<computer-name>,<public-address>,<private-address> sha256=12f1fa4ee38412a76f0712dac1079f7d322e238ec67f15705d639853dbcf3eb2
2026-12-02T22:10:40.1280245Z certificate, key and Caddyfile written
2026-12-02T22:10:40.2149505Z credentials written
2026-12-02T22:12:59.2211564Z Ollama answers on 127.0.0.1:11434; HTTPS on 443 asks for the password; 80 listens
2026-12-02T22:13:12.0126775Z first boot done

The certificate is named for the VM's public IP address, its private IP address and its computer name, and is valid for ten years. Its public half is C:\ProgramData\OllamaProxy\tls\cert.pem.

Step 5 - Read your password

First boot wrote the user name and password to a file that only the SYSTEM account and the Administrators group can read:

Get-Content C:\ProgramData\ollama-windows-server-credentials.txt
# Ollama on Windows Server 2025 by cloudimg: this VM's own sign-in for the Ollama API (made at first boot).
# Call https://<this VM's public IP>/api/... (port 80 redirects there) with HTTP Basic auth: the user and password below.
# The certificate is this VM's own, self-signed: its public half is C:\ProgramData\OllamaProxy\tls\cert.pem.
# Guide: https://www.cloudimg.co.uk/guides/ollama-on-windows-server-2025-azure/

ollama-windows-server.admin.user=admin
ollama-windows-server.admin.password=<24 random characters, different on every VM>

The user name is always admin; the password is random and different on every VM. Keep it somewhere safe and share it only with the people and applications that should use the API.

An elevated PowerShell window: the credentials file readable by SYSTEM and Administrators only, and its contents with the password hidden

Step 6 - Check the API and the starter model

Every request goes through HTTPS with the user name and password. This is a session on the VM itself, in PowerShell, with curl.exe (part of Windows). -k is needed because the certificate is the VM's own self signed one. The password is read into a variable and never shown:

PS> $pw = (Select-String C:\ProgramData\ollama-windows-server-credentials.txt -Pattern 'admin\.password=(\S+)').Matches[0].Groups[1].Value

PS> curl.exe -sk -o NUL -w "%{http_code}`n" https://127.0.0.1/api/tags
401

PS> curl.exe -sk -u "admin:$pw" https://127.0.0.1/api/version
{"version":"0.40.19"}

PS> curl.exe -sk -u "admin:$pw" https://127.0.0.1/api/tags
{"models":[{"name":"llama3.2:1b","model":"llama3.2:1b","modified_at":"2026-12-02T21:48:40.3183756Z","size":1321098329,"digest":"baf6a787fdffd633537aa2eb51cfd54cb93ff08e28040095462bb63daf552878","details":{"parent_model":"","format":"gguf","family":"llama","families":["llama"],"parameter_size":"1.2B","quantization_level":"Q8_0", ...}}]}

Without the password every path answers 401. With it, the API reports its version and the models on the server:

PowerShell on the server: the Ollama services running, the Ollama version and the Llama 3.2 1B starter model, read through HTTPS with the VM's password

Step 7 - Chat with a model

Ollama's own chat endpoint is POST /api/chat. Windows PowerShell 5.1 changes double quotes on the way to curl.exe, so the request body goes in a file and --data-binary "@file" sends it unchanged:

PS> '{"model":"llama3.2:1b","stream":false,"messages":[{"role":"user","content":"Name three uses for a private LLM, one line each."}]}' | Set-Content chat.json -Encoding ascii
PS> (curl.exe -sk -u "admin:$pw" https://127.0.0.1/api/chat --data-binary "@chat.json" | ConvertFrom-Json).message.content
Here are three potential uses for a private Large Language Model (LLM):

1. Confidential business decision-making: A private LLM could be used to analyze sensitive business data and provide discreet, personalized insights to key decision-makers without compromising confidentiality.
2. Personalized education: A private LLM could be used to create tailored learning experiences for students, providing real-time feedback and adaptive learning paths to help them better understand complex concepts.
3. Medical research and development: A private LLM could be used to analyze large datasets and identify patterns that may not be apparent through traditional methods, potentially leading to new medical discoveries and treatments.

The answer also says how many tokens the model generated (eval_count) and how long it took in nanoseconds (total_duration). This was the first question on a fresh Standard_B2ms, so the time includes loading the model:

A question to Llama 3.2 1B over /api/chat through HTTPS, with the answer and the time it took on CPU

Leave out "stream":false and Ollama streams the answer as it is generated, one JSON line per piece; Caddy passes each piece on as soon as it arrives. The first request after a while loads the model into memory, and later ones answer faster. Ollama unloads an idle model after five minutes.

Step 8 - Use the OpenAI compatible API

Ollama also answers OpenAI's chat completions API at /v1/chat/completions, with the same user name and password:

PS> '{"model":"llama3.2:1b","max_tokens":40,"messages":[{"role":"user","content":"Say hello in French."}]}' | Set-Content oai.json -Encoding ascii
PS> curl.exe -sk -u "admin:$pw" https://127.0.0.1/v1/chat/completions -H "Content-Type: application/json" --data-binary "@oai.json"
{"id":"chatcmpl-147","object":"chat.completion","created":1796250221,"model":"llama3.2:1b","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"Bonjour ! Comment puis-je vous aider aujourd'hui ?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":30,"prompt_tokens_details":{"cached_tokens":20},"completion_tokens":12,"total_tokens":42}}

The OpenAI compatible /v1/chat/completions endpoint answering through HTTPS

From another machine, use https://<vm-public-ip>/ in place of https://127.0.0.1/, for example curl -k -u "admin:<password>" https://<vm-public-ip>/api/tags from macOS or Linux. An application or OpenAI client library points its base URL at https://<vm-public-ip>/v1. Because the password check is HTTP Basic authentication, the client must send the header Authorization: Basic <base64 of admin:password>. Set it as a custom or default header where the client allows one, and trust the VM's certificate (cert.pem) or install your own (see Use a DNS name and a trusted certificate below).

Step 9 - Pull more models

Pull any model from the Ollama library with POST /api/pull. This pulls the small all-minilm embedding model, makes an embedding with it (384 numbers), then deletes it:

PS> '{"model":"all-minilm","stream":false}' | Set-Content pull.json -Encoding ascii
PS> curl.exe -sk -u "admin:$pw" https://127.0.0.1/api/pull --data-binary "@pull.json"
{"status":"success"}

PS> '{"model":"all-minilm","input":"cloudimg"}' | Set-Content embed.json -Encoding ascii
PS> (curl.exe -sk -u "admin:$pw" https://127.0.0.1/api/embed --data-binary "@embed.json" | ConvertFrom-Json).embeddings[0].Count
384

PS> '{"model":"all-minilm"}' | Set-Content del.json -Encoding ascii
PS> curl.exe -sk -u "admin:$pw" https://127.0.0.1/api/delete -X DELETE --data-binary "@del.json" -o NUL -w "%{http_code}`n"
200

On the server itself, & "C:\Program Files\Ollama\ollama.exe" pull <model> does the same, and ollama run <model> opens an interactive chat in the console. Models are stored in C:\ProgramData\Ollama\models on the OS disk. Before pulling a large model, check it fits both the VM's memory and the disk's free space, and grow the OS disk in Azure if needed. Each model's page in the library shows its licence; the licence is yours to accept for the models you pull. Uploads through the HTTPS front are limited to 64 MB per request. To create a model from a large local GGUF file, run ollama create on the server itself rather than over the API.

An elevated PowerShell window: the starter model on the server, its details and licence from ollama show, and C:\ProgramData\Ollama locked to SYSTEM, Administrators and the Ollama service

How the API is protected

PS> curl.exe -sk -o NUL -w "no password: HTTP %{http_code}`n" https://127.0.0.1/api/tags
no password: HTTP 401
PS> curl.exe -sk -o NUL -w "with password: HTTP %{http_code}`n" -u "admin:$pw" https://127.0.0.1/api/tags
with password: HTTP 200

401 without the password, Ollama on loopback only with Caddy on 80 and 443, and the two inbound firewall rules

Caddy checks the password before passing a request on, and removes the Authorization header so Ollama never sees the password. Ollama and the model runners it starts listen only on 127.0.0.1. Windows Firewall allows 443 and 80 through the two rules in the Ollama group; the network security group decides who can reach them.

Change the password

The password is checked by Caddy, which keeps only a bcrypt hash of it in C:\ProgramData\OllamaProxy\Caddyfile. To change it, open an administrator PowerShell, make the hash of your new password, put it in place of the old hash on the admin line of the Caddyfile, and restart the front:

& 'C:\Program Files\Ollama\caddy\caddy.exe' hash-password --plaintext '<new password>'
notepad C:\ProgramData\OllamaProxy\Caddyfile      # basic_auth { admin <the new hash> }
Restart-Service OllamaProxy

Update the password in C:\ProgramData\ollama-windows-server-credentials.txt too, so the file stays right. To give each person or application its own password, add one <name> <hash> line per user inside basic_auth.

Use a DNS name and a trusted certificate

The image's certificate is self signed and named for the VM's IP addresses and computer name. To use a DNS name with a certificate your clients already trust:

  1. Point the name at the VM's public IP.
  2. Get a certificate and key for that name as PEM files.
  3. Replace C:\ProgramData\OllamaProxy\tls\cert.pem with the certificate, followed by any intermediate certificates.
  4. Replace key.pem in the same folder with the private key.
  5. Run Restart-Service OllamaProxy.

Maintenance

  • Windows updates: Windows Update is on, as Microsoft ships it. Restarting the VM restarts both services automatically.
  • Back up your data: Ollama keeps its models and identity key in C:\ProgramData\Ollama. The front keeps its Caddyfile and certificate in C:\ProgramData\OllamaProxy. Back up both folders, or use Azure Backup of the VM. Models can always be pulled again.
  • Upgrade Ollama: you choose when to upgrade.
  • Download ollama-windows-amd64.zip of the version you want from the project's GitHub releases.
  • In an administrator PowerShell, stop the services: Stop-Service OllamaProxy, Ollama.
  • Replace ollama.exe and the lib\ollama folder in C:\Program Files\Ollama with the ones from the zip. You can leave out its cuda_* and vulkan folders on a CPU VM.
  • Start them again: Start-Service Ollama, OllamaProxy.

Your models are kept. - Logs: Ollama's log is in C:\ProgramData\Ollama\service-logs and Caddy's in C:\ProgramData\OllamaProxy\logs. The first boot log is C:\ProgramData\ollama-windows-server-firstboot.log; it never contains the password. - GPU: this image is built and tested for CPU. It does not include NVIDIA's CUDA libraries.

Support

cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours. Contact support@cloudimg.co.uk.