-
Notifications
You must be signed in to change notification settings - Fork 0
Run as an Azure Web App Using GitHub Action
emmanuel edited this page Aug 10, 2023
·
3 revisions
This process will allow you to deploy the Azure DevOps Naming Tool as a .NET application as an Azure Web App. This is the fastest deployment option and allows you to deploy and utilize your installation in minutes. The provided GitHub Action will deploy your repository code on every commit. This installation process provides the most secure, scalable solution for your installation.
At a high level, this is the installation process:
-
Fork the Azure DevOps Naming Tool Repository
-
Create an Azure Web App
The App Service can be created manually, or leverage the Deploy to Azure options below.
-
Enable Azure Web App Authentication
Require users to authenticate to Azure AD to access the App Service.
-
Generate Azure Web App Credentials
These credentials will be used for GitHub to authenticate to your Azure subscription.
-
Create GitHub secrets
These secrets are used by the GitHub Action to build the application in the Azure App Service.
-
Enable GitHub Action
Enable automative deployment of the tool when GitHub repository is updated.
- Scroll up to the top-left corner of this page.
- Click on the AzureNamingTool link to open the root of this repository.
- Click the Fork option in the top-right menu.
- Select your desired Owner and Repository name and click Create fork.
- Click the green <>Code button
- Click the .github/workflows link.
- Click the .deploy-azure-naming-tool-to-azure-webapps-dotnet-core.yml link.
- Review the instructions for creating the required GitHub secrets.
NOTES:
- The GitHub Action will not successfully deploy until the secrets are created.
- You must create an Azure Web App and configure the GitHub Action secrets to deploy to your Azure Web App.
For an automated deployment of a Web App, utilize the button below and fill in the required information. Then proceed to step 4.
- Create a new Azure Web App in the Azure portal.
- For the Publish option, select Code.
- For the Runtime stack, select .NET 7.
- Download the Publish Profile for use within the GitHub Action secret.
Get-AzWebApp -Name <webappname> | Get-AzWebAppPublishingProfile -OutputFile <filename> | Out-Null
** OR **
- In the Azure Portal for your Azure Web App, Navigate to the Authentication blade.
- Select Add identity provider.
- In the Identity provider section, select Microsoft.
- Enter the desired Name. All other options can be left as default.
- Click Add.
- In a command prompt, execute the following command to create credentials for the Azure Web App:
az ad sp create-for-rbac --name "[YOUR CREDENTIAL NAME - ENTER ANY VALUE]" --role contributor --scopes /subscriptions/[YOUR SUBSCRIPTION ID]/resourceGroups/[YOUR RESORUCE GROUP NAME] --sdk-auth
- Copy the returned value for later use.
{
"clientId": "[YOUR CLIENT ID]",
"clientSecret": "[YOUR CLIENT SECRET]",
"subscriptionId": "[YOUR SUBSCRIPTION ID]",
"tenantId": "[YOUR TENANT ID]",
"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/"
}
- In your GitHub repository, click Settings in the top menu.
- Click Secrets in the left menu.
- Click New repository secret.
- Enter AZURE_WEBAPP_PUBLISH_PROFILE as the Name.
- Enter the Publish Profile data for your Azure Web App as the Value.
- Click Add secret.
- Click New repository secret.
- Enter AZURE_WEBAPP_NAME as the Name.
- Enter the name of your Azure Web App as the Value.
- Click Add secret.
- Click New repository secret.
- Enter AZURE_CREDENTIALS as the Name.
- Enter the Azure Web App Credentials JSON as the Value:
- In your GitHub repository, click the Actions tab.
- Click on I understand my workflows, go ahead and enable them.
- Select the Azure DevOps Naming Tool - Build and deploy to an Azure Web App workflow in the left navigation.
- Click Run workflow.
- Confirm the workflow completes successfully.
- Access your Azure Web App to confirm the site is successfully deployed.