Create an Azure App Service Web App
Authentication verifies who a user is, while authorization decides what that user can do. Azure App Service handles authentication through built-in support for identity providers like Microsoft Entra ID, Facebook, Google, and X, using OAuth 2.0 to manage the login flow. When a user tries to access your app, unauthenticated requests get redirected to the chosen provider before reaching your code. You configure this through the Authentication blade in the Azure portal, where you specify supported account types, what happens for unauthenticated requests, and whether to store tokens for session management.
Role-Based Access Control (RBAC) manages authorization by assigning permissions to users, groups, or applications at specific scopes, following the principle of least privilege to limit access to only what is needed. For example, you can restrict a web app to only accept users from your organization's Microsoft Entra tenant.
Service integrations extend your app's capabilities. Azure Key Vault stores secrets, keys, and certificates so your app can access them securely without hardcoding values in your code. Azure Monitor and Application Insights track performance, health, and usage to help you find and fix problems. Virtual Network Integration lets your app connect to resources inside an Azure virtual network, and you can use network security groups to control which IP addresses can reach your app.
To connect securely to back-end services like Azure SQL Database, you use a managed identity instead of storing passwords in your code. The managed identity represents your app to other Azure services, and you assign it roles like Storage Blob Data Contributor to grant access. Your code uses the DefaultAzureCredential class from the Azure Identity library to automatically get a token using the managed identity.
Getting code from a developer's machine to Azure App Service uses several deployment methods. GitHub Actions and Azure Pipelines provide automated continuous integration and continuous delivery (CI/CD), automatically building, testing, and deploying code whenever changes are pushed to a repository. The deployment source holds the code (like GitHub or Azure Repos), the build pipeline prepares the app, and the deployment mechanism places it into the web app.
For simpler needs, Local Git lets you push code directly from your computer to Azure, while ZIP deployment uploads a compressed file that Azure unpacks into your web app's folder. Both work well for quick updates without complex automation.
Deployment slots enable blue-green deployment strategies. Instead of deploying straight to production, you deploy to a staging slot to test changes in an environment that mirrors the live site. When ready, a slot swap moves staging into production, giving you zero-downtime updates and an easy rollback if problems appear.
Securing the deployment process matters. Using Microsoft Entra ID or Service Principals instead of basic authentication with usernames and passwords protects your Azure environment from unauthorized changes.
An App Service Plan provides the compute resources where your web apps run, and a Web App is an HTTP-based application hosted by Azure within that plan. The plan determines how much power you have, and you can run multiple web apps on the same plan.
When creating an App Service Plan, you choose the pricing tier (Free, Shared, Basic, Standard, Premium, or Isolated), the region where resources are located, and scaling options like scaling up to a higher tier or scaling out by adding more instances. These choices affect cost, performance, and capacity.
Deploy a web app through the Azure portal, Azure CLI, or PowerShell, specifying the target plan, runtime stack (like Node.js or .NET), and resource group. The web app then uses the plan's compute resources.
After deployment, add custom domains and SSL certificates through DNS entries and the Custom domains blade. You can use managed certificates from Azure or upload your own, then bind them to enable HTTPS.
Configure authentication using EasyAuth or Azure AD, then set application settings and connection strings through the portal or commands. These settings become environment variables that your code reads at runtime, letting you manage secrets and configuration without rebuilding your application.