Skip to content
This repository was archived by the owner on Sep 14, 2025. It is now read-only.

Latest commit

 

History

History
123 lines (95 loc) · 3.12 KB

File metadata and controls

123 lines (95 loc) · 3.12 KB

Fix Azure Deployment Issues

Problem

GitHub Actions deployment is failing with error:

Login failed with Error: Using auth-type: SERVICE_PRINCIPAL. 
Not all values are present. Ensure 'client-id' and 'tenant-id' are supplied.

Solution

Option 1: Create New Azure Service Principal

  1. Login to Azure CLI:
az login
  1. Get your subscription ID:
az account show --query id -o tsv
  1. Create service principal with correct format:
# Replace YOUR_SUBSCRIPTION_ID with actual ID
az ad sp create-for-rbac \
  --name "github-actions-crove" \
  --role contributor \
  --scopes /subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/Crove \
  --sdk-auth
  1. Copy the JSON output (should look like this):
{
  "clientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "tenantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
  "resourceManagerEndpointUrl": "https://management.azure.com/",
  "activeDirectoryGraphResourceId": "https://graph.windows.net/",
  "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
  "galleryEndpointUrl": "https://gallery.azure.com/",
  "managementEndpointUrl": "https://management.core.windows.net/"
}
  1. Update GitHub secret:
# Delete old secret
gh secret delete AZURE_CREDENTIALS --repo CroveAI/Crove

# Add new secret (paste the JSON when prompted)
gh secret set AZURE_CREDENTIALS --repo CroveAI/Crove

Option 2: Use Alternative Deployment Method

Since Docker Hub credentials are working, we can simplify the deployment:

  1. Update the workflow to use SSH instead of Azure CLI:

Edit .github/workflows/deploy-azure-vm.yml:

  • Remove Azure login step
  • Use SSH action instead of Azure CLI
  1. Add SSH key to GitHub secrets:
# Generate SSH key if not exists
ssh-keygen -t ed25519 -C "github-actions" -f ~/.ssh/github-actions -N ""

# Add public key to Azure VM
ssh-copy-id -i ~/.ssh/github-actions.pub joy@52.172.194.116

# Add private key to GitHub
gh secret set SSH_PRIVATE_KEY --repo CroveAI/Crove < ~/.ssh/github-actions

Option 3: Manual Deployment Until Fixed

Use the deployment script:

./deploy-beta.sh

Or trigger deployment manually via SSH:

ssh joy@52.172.194.116 "cd /home/joy/crove && git pull && docker-compose -f docker-compose.production.yml up -d --build"

Verification

After fixing, test the deployment:

  1. Trigger GitHub Actions manually:
gh workflow run "Deploy to Azure VM" --repo CroveAI/Crove
  1. Watch the run:
gh run watch --repo CroveAI/Crove
  1. Check deployment status:
curl -I https://beta.crove.com

Current Status

  • ✅ Docker Hub credentials: Working
  • ✅ Docker image build: Working
  • ❌ Azure login: Failed (incorrect credential format)
  • ❌ VM deployment: Not reached due to Azure login failure

Next Steps

  1. Fix Azure credentials (recommended)
  2. Or switch to SSH-based deployment
  3. Or use manual deployment until resolved