Draft
Switch Terraform backend to use storage account keys instead of Azure AD authentication#617
Conversation
…default Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
… variables Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
…ntation Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix authorization permission issue in deployment
Fix GitHub Actions authentication to Terraform state storage
Dec 4, 2025
Owner
|
@copilot this still doesn't work. Can you update to use storage account keys instead of azure ad authentication? |
Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
Contributor
Author
Switched to storage account key authentication in commit 02eea38. The workflow now uses # Get the storage account access key
az storage account keys list \
--resource-group rg-mlshop-tfstate \
--account-name mlshoptfstate \
--query '[0].value' -o tsv
# Add the output as a GitHub secret named TF_STATE_STORAGE_ACCESS_KEYThis is simpler and more reliable than the Azure AD approach. |
…date descriptions Co-authored-by: aluczak <96292122+aluczak@users.noreply.github.com>
Copilot
AI
changed the title
Fix GitHub Actions authentication to Terraform state storage
Switch Terraform backend to use storage account keys instead of Azure AD authentication
Dec 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Actions fails during
terraform initwith 403 AuthorizationPermissionMismatch. The original approach using Azure AD authentication with role assignments proved unreliable. This PR switches to using storage account keys for simpler and more reliable authentication.Solution
Changed from Azure AD authentication to storage account key authentication for the Terraform backend:
GitHub Actions Workflow (
.github/workflows/deploy-infrastructure.yml):ARM_USE_AZUREAD_AUTHenvironment variable from all Terraform stepsaccess_keyinstead ofuse_azuread_authTF_STATE_STORAGE_ACCESS_KEYBackend Configuration (
backend.hcl.example): Removeduse_azuread_authsettingDocumentation Updates:
TF_STATE_STORAGE_ACCESS_KEYto required GitHub secrets, removed Azure AD troubleshootingConfiguration Examples:
tf_state_*variables optional (commented out)tf_state_*from exampleBenefits
Setup for GitHub Actions
Add the storage account access key as a GitHub secret:
az storage account keys list \ --resource-group rg-mlshop-tfstate \ --account-name mlshoptfstate \ --query '[0].value' -o tsvAdd the output as secret
TF_STATE_STORAGE_ACCESS_KEYin your GitHub repository.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.