# Microsoft (.NET, PowerShell) mirror (pkg.shecan.ir)

> Mirror of the Microsoft production repositories on packages.microsoft.com for apt and dnf (PowerShell, .NET, Azure CLI, Azure Functions Core Tools, mssql-tools, msodbcsql, SQL Server), at the same paths: <distro>/<version>/prod, <distro>/<version>/mssql-server-*, repos/azure-cli, keys/, config/.

- Upstream: packages.microsoft.com
- Mirror URL: <https://mirror-pmc.pkg.shecan.ir/>
- Clients: apt, dnf
- Service status: <https://pkg.shecan.ir/status.json> (key `pmc`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/pmc/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/pmc.json>

## Limitations

- apt and dnf still verify Microsoft's signature.
- packages-microsoft-prod.deb is not served: it would point apt back at packages.microsoft.com. Add the key and the source as shown instead.
- Ubuntu 24.04 and newer get .NET from Ubuntu's own archive (dotnet-sdk-8.0 through the Ubuntu mirror); Microsoft's repository for those releases has PowerShell, SQL tools and Azure tools but no .NET SDK.
- VS Code has its own mirror (mirror-vscode.pkg.shecan.ir); other packages.microsoft.com repositories (Edge, Teams, ...) are not mirrored.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### apt: persistent (user- or system-wide configuration)

Run, Ubuntu or Debian (linux)

```sh
sudo install -d /etc/apt/keyrings
sudo curl -fsSLo /etc/apt/keyrings/microsoft.asc https://mirror-pmc.pkg.shecan.ir/keys/microsoft.asc
. /etc/os-release
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/microsoft.asc] https://mirror-pmc.pkg.shecan.ir/$ID/$VERSION_ID/prod $VERSION_CODENAME main" | sudo tee /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update && sudo apt install -y powershell
```

Undo / restore the default, Ubuntu or Debian (linux)

```sh
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update
```

Run, Debian, .NET SDK (linux)

```sh
sudo apt install -y dotnet-sdk-8.0
```

Run, Azure CLI (linux)

```sh
. /etc/os-release
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/microsoft.asc] https://mirror-pmc.pkg.shecan.ir/repos/azure-cli/ $VERSION_CODENAME main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt update && sudo apt install -y azure-cli
```

Undo / restore the default, Azure CLI (linux)

```sh
sudo rm -f /etc/apt/sources.list.d/azure-cli.list
sudo apt update
```

### dnf: persistent (user- or system-wide configuration)

Run, EL 8/9/10 (linux)

```sh
sudo curl -fsSLo /etc/yum.repos.d/microsoft-prod.repo https://mirror-pmc.pkg.shecan.ir/config/rhel/$(rpm -E %rhel)/prod.repo
sudo dnf install -y powershell
```

Undo / restore the default, EL 8/9/10 (linux)

```sh
sudo rm -f /etc/yum.repos.d/microsoft-prod.repo
sudo dnf clean all
```
