Skip to content

Instantly share code, notes, and snippets.

@arnathan2k
Created April 15, 2024 13:14
Show Gist options
  • Save arnathan2k/9b66d8576ecb7137568fdf469174e15f to your computer and use it in GitHub Desktop.
Save arnathan2k/9b66d8576ecb7137568fdf469174e15f to your computer and use it in GitHub Desktop.
I want create a standard web app in azure and allow web admins to deploy apps consistently how to do this?
Creating a standard web app in Azure and setting up a consistent deployment process for web admins involves several steps. You can leverage Azure services like Azure App Service for hosting the web app and Azure DevOps or GitHub Actions for continuous integration and continuous deployment (CI/CD). Here’s a step-by-step guide to achieve this:
### Step 1: Create an Azure Web App
1. **Log into Azure Portal**: Go to the [Azure Portal](https://portal.azure.com).
2. **Create a Web App**:
- Navigate to "App Services" and click on "Create".
- Select the appropriate subscription and resource group.
- Enter a unique name for your web app.
- Select the runtime stack (e.g., .NET, Java, Node.js, Python) and either Windows or Linux as the operating system.
- Choose a region.
- Select an App Service Plan or create a new one (scale and pricing depend on your needs).
- Click "Review + create" and then "Create" to deploy the web app.
### Step 2: Set Up Source Control
1. **Choose a Source Control System**:
- You can use GitHub, Azure Repos, or any other Git repository for version control.
- Create a new repository if necessary and push your web application's code to it.
### Step 3: Configure CI/CD with Azure DevOps or GitHub Actions
#### Using Azure DevOps
1. **Create a Project in Azure DevOps**:
- Navigate to [Azure DevOps](https://dev.azure.com) and create a new project.
2. **Set Up a Build Pipeline**:
- Go to Pipelines > Pipelines and create a new pipeline.
- Connect to your source control and select the repository containing your web app.
- Choose a template or configure the pipeline from scratch using YAML to build your application.
3. **Set Up a Release Pipeline**:
- Go to Pipelines > Releases and create a new release pipeline.
- Add an artifact from the build pipeline.
- Add a stage to deploy to Azure App Service.
- Configure the deployment task to deploy the build artifact to the Azure Web App.
#### Using GitHub Actions
1. **Set Up GitHub Actions**:
- In your GitHub repository, create a new workflow in the `.github/workflows` directory.
- Define the workflow using YAML to build and deploy your app. Here’s an example workflow:
```yaml
name: Build and Deploy to Azure Web App
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build
run: |
npm install
npm run build
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
with:
app-name: 'YourAppName'
slot-name: 'production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: '.'
```
- Ensure you add the Azure Web App publish profile as a secret in your GitHub repository.
### Step 4: Configure Application Settings
- **Manage Application Settings in Azure**:
- Navigate to your App Service in the Azure portal.
- Under "Settings", select "Configuration" to manage application settings and connection strings securely.
### Step 5: Train Web Admins
- **Documentation and Training**:
- Create documentation on the deployment process.
- Train web admins on how to use source control and trigger deployments through Azure DevOps or GitHub Actions.
By following these steps, you will have set up a standard web application in Azure with a robust CI/CD pipeline that allows web admins to deploy updates consistently and efficiently. This setup not only standardizes deployments but also helps in maintaining control and visibility over application deployments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment