# Azure Setup Scripts

This directory contains scripts for setting up Azure infrastructure prerequisites for The Order.

## Scripts

### 1. `azure-setup.sh` - Complete Azure Setup

Comprehensive setup script that:
- Lists all available Azure Commercial regions (excluding US)
- Sets default region to West Europe
- Checks and registers required resource providers
- Checks quotas for primary regions
- Generates reports

**Usage:**
```bash
./infra/scripts/azure-setup.sh
```

**Output Files:**
- `azure-regions.txt` - List of all non-US regions
- `azure-quotas.txt` - Quota information for primary regions

### 2. `azure-register-providers.sh` - Register Resource Providers

Registers all required Azure Resource Providers for The Order.

**Usage:**
```bash
./infra/scripts/azure-register-providers.sh
```

**What it does:**
- Checks registration status of all required providers
- Registers unregistered providers
- Waits for registration to complete
- Reports final status

### 3. `azure-check-quotas.sh` - Check Quotas for All Regions

Checks quotas for all non-US Azure regions.

**Usage:**
```bash
./infra/scripts/azure-check-quotas.sh
```

**Output:**
- `azure-quotas-all-regions.txt` - Detailed quota information for all regions

## Prerequisites

1. **Azure CLI installed**
   ```bash
   # Check if installed
   az --version
   
   # Install if needed
   # https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
   ```

2. **Azure CLI logged in**
   ```bash
   az login
   az account show
   ```

3. **Required permissions**
   - Subscription Contributor or Owner role
   - Ability to register resource providers
   - Ability to check quotas

## Quick Start

1. **Login to Azure**
   ```bash
   az login
   ```

2. **Run complete setup**
   ```bash
   ./infra/scripts/azure-setup.sh
   ```

3. **Verify providers are registered**
   ```bash
   ./infra/scripts/azure-register-providers.sh
   ```

4. **Check quotas**
   ```bash
   ./infra/scripts/azure-check-quotas.sh
   ```

## Required Resource Providers

See `infra/terraform/AZURE_RESOURCE_PROVIDERS.md` for complete list.

## Default Region

**West Europe (westeurope)** is the default region. US Commercial and Government regions are **not used**.

## Troubleshooting

### Script fails with "not logged in"
```bash
az login
az account set --subscription <subscription-id>
```

### Provider registration fails
- Check subscription permissions
- Verify subscription is active
- Wait 5-10 minutes and retry

### Quota check fails
- Some regions may not support all quota types
- Check individual regions manually if needed

## Output Files

All scripts generate output files in the current directory:

- `azure-regions.txt` - List of available regions
- `azure-quotas.txt` - Quotas for primary regions
- `azure-quotas-all-regions.txt` - Quotas for all regions

Review these files to understand available resources and limits.

