A Developer's Guide to .NET in Azure

Book description

Develop cloud-native applications using serverless technologies, Azure services, and .NET with the help of this reference guide

Key Features

  • Create cloud-native .NET applications using cutting-edge technologies
  • Design, develop, and deploy scalable, manageable, and resilient apps with various Azure services
  • Explore serverless architecture and optimize application scalability through efficient design
  • Purchase of the print or Kindle book includes a free PDF eBook

Book Description

A Developer’s Guide to .NET in Azure helps you embark on a transformative journey through Microsoft Azure that is tailored to .NET developers. This book is a curated compendium that’ll enable you to master the creation of resilient, scalable, and highly available applications.

The book is divided into four parts, with Part 1 demystifying Azure for you and emphasizing the portal's utility and seamless integration. The chapters in this section help you configure your workspace for optimal Azure synergy. You’ll then move on to Part 2, where you’ll explore serverless computing, microservices, containerization, Dapr, and Azure Kubernetes Service for scalability, and build pragmatic, cost-effective applications using Azure Functions and Container apps. Part 3 delves into data and storage, showing you how to utilize Azure Blob Storage for unstructured data, Azure SQL Database for structured data, and Azure Cosmos DB for document-oriented data. The final part teaches you about messaging and security, utilizing Azure App Configuration, Event Hubs, Service Bus, Key Vault, and Azure AD B2C for robust, secure applications.

By the end of this book, you’ll have mastered Azure's responsive infrastructure for exceptional applications.

What you will learn

  • Discover how to create serverless apps and services
  • Design microservices with Azure Kubernetes service
  • Get to grips with different Azure databases and storage services
  • Find out how to use secret and configuration management
  • Familiarize yourself with event-driven architecture
  • Understand how to leverage Azure Service Bus and Azure Event Hubs
  • Find out how to protect APIs and apps using Azure B2C

Who this book is for

This book is for .NET developers and architects who are eager to master the art of creating and deploying robust applications using .NET and Azure. A foundational understanding of .NET and Azure will enable you to enhance your skills with this resourceful guide. Developers aspiring to explore the realms of microservices and serverless applications within the .NET and Azure landscapes will find this book invaluable.

Table of contents

  1. A Developer’s Guide to .NET in Azure
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Conventions used
    5. Get in touch
    6. Share Your Thoughts
    7. Download a free PDF copy of this book
  6. Part 1: An Introduction to Your Environment
  7. Chapter 1: Setting Up Your Development Environment
    1. Creating your Azure subscription
      1. Creating resources in the Azure portal
    2. Configuring your development environment
      1. Installing .NET 6.0
    3. Setting up your local environment for Azure development
      1. Installing Visual Studio Code
      2. Installing Visual Studio Community 2022
    4. Creating your first project
    5. Summary
  8. Part 2: Serverless and Microservices
  9. Chapter 2: Creating Docker Containers on Azure
    1. Technical requirements
    2. Installing Docker
    3. Exploring Docker and basic Docker commands
      1. Docker architecture
      2. Docker development life cycle
      3. Docker commands
    4. Creating Docker images for your ASP.NET Core application
      1. Containerizing an ASP.NET Core application with the Docker CLI and Dockerfile
      2. Containerizing your ASP.NET Core app with VS Code
      3. Containerizing your ASP.NET Core with Visual Studio
    5. Creating and configuring Azure Container Registry
    6. Deploying web apps to Azure App Service from Azure Container Registry
    7. Configuring CI/CD with ACR
      1. Deploying a Docker image to App service from ACR using managed identities
    8. Summary
  10. Chapter 3: Building Resilient Applications with Dapr
    1. Technical requirements
    2. Installing Dapr
    3. What is Dapr?
      1. Dapr architecture
      2. Running ASP.NET Core with a Dapr Sidecar
    4. Exploring Dapr’s building blocks
      1. Service-to-service invocation
      2. State management
      3. Publish and subscribe
    5. Enabling Dapr support in Azure Container Apps
    6. Summary
  11. Chapter 4: Designing Microservices with AKS and Containers in Azure
    1. What is Kubernetes?
      1. How does Kubernetes achieve its goals?
    2. Self-hosted Kubernetes versus Azure Kubernetes Service
      1. Self-hosted Kubernetes
      2. Azure Kubernetes Service
      3. Kubernetes Pods
      4. Kubernetes control plane
      5. Kubernetes Service
      6. Nodes
      7. Persistent Volumes
      8. Deployments
      9. Ingress
    3. Setting up an Azure Kubernetes Service cluster
    4. Troubleshooting Pods and Deployments
    5. Introducing containers
      1. Difference between containers and AKS
      2. When to use Azure Container Instances
      3. Container groups
      4. ACI connector for Kubernetes
    6. Summary
  12. Chapter 5: Building Serverless Apps with Azure Functions and Container Apps
    1. Overview of serverless computing
    2. Monolithic architecture versus microservice architecture
      1. Resource provisioning and management
      2. Scaling
      3. Cost
      4. Deployment and management
      5. Event-driven architecture
    3. Introducing Azure Functions
      1. Azure Functions use cases
      2. Azure Functions runtime
      3. Azure Functions – in-process versus isolated process
      4. Azure Functions plans
      5. Exploring the Azure ASE
    4. Azure Functions triggers
      1. HTTP trigger
      2. Azure Functions bindings
      3. The host.json file
    5. Delving into Azure Functions security
      1. Authentication and authorization
      2. Managed identities for Azure Functions
      3. Azure Functions access keys
      4. Authorization scopes in Azure Functions
    6. Azure Durable Functions
      1. Elements of Azure Durable Functions
      2. Stateful versus stateless workflows
      3. Application patterns
    7. Setting up an Azure function
    8. Getting started with Azure Container Apps
      1. Azure Container Apps overview
    9. Deploying Docker containers to Azure Container Apps
      1. Deploying a container to Azure Container Apps via the Azure portal
      2. Deploying a container to Azure Container Apps via the Azure CLI
      3. Configuring CI/CD from source control to Azure Container Apps
    10. Summary
  13. Part 3: Data and Storage
  14. Chapter 6: Exploring Azure Blob Storage
    1. What is Azure Blob Storage?
    2. Types of blobs in Azure Blob Storage
      1. Block blobs
      2. Page blobs
      3. Append blobs
    3. Pricing tiers
    4. Lifecycle management
      1. Transitioning between tiers
      2. Automated data expiry
      3. Rule definitions
    5. Creating a Blob Storage account in Azure
    6. Blob Storage availability
      1. Locally-redundant storage
      2. Zone-redundant storage
      3. Geo-redundant storage
      4. Read-access geo-redundant storage
      5. Choosing the right replication type for your application
    7. Avoiding common mistakes and pitfalls
    8. Understanding the .NET client library
    9. Security in Azure Blob Storage
      1. Public access levels
      2. Shared Access Signature
      3. Azure Active Directory
      4. Role-based access control with Azure AD
      5. Encryption in Azure Blob Storage
    10. Summary
  15. Chapter 7: Creating an Azure SQL Database
    1. Technical requirements
    2. Introducing Azure SQL Database
    3. Creating an Azure SQL database
      1. Creating an Azure SQL database using the Azure portal
      2. Creating an Azure SQL database using the Azure CLI
      3. Creating an Azure SQL database using the Azure ARM template
    4. Writing and reading data from Azure SQL Database using .NET Core and EF Core
      1. Connecting to Azure SQL Database from ASP.NET Core
    5. Configuring security in Azure SQL Database
      1. Connecting to Azure SQL Server using an identity
      2. Working with system-assigned managed identities
      3. Configuring an Azure SQL firewall
      4. Configuring the Azure SQL Server private endpoint
    6. Summary
  16. Chapter 8: Creating Documents via .NET for Azure Cosmos DB
    1. Introduction to Azure Cosmos DB
      1. The Document API (SQL API)
      2. The Table API
      3. The MongoDB API
      4. The Gremlin API (Graph API)
      5. Request units in Cosmos DB
    2. Performance and scaling in Azure Cosmos DB
      1. What are throughput, latency, and RUs in Cosmos DB?
      2. Optimizing for throughput in Cosmos DB
      3. Optimizing for latency in Cosmos DB
      4. Optimizing for RUs in Cosmos DB
      5. Best practices for performance and scaling in Cosmos DB
    3. Explaining containers in Azure Cosmos DB
      1. Items in Azure Cosmos DB
      2. Consistency in Azure Cosmos DB
      3. Strong consistency
      4. Bounded staleness
      5. Session consistency
      6. Consistent prefix
      7. Eventual consistency
    4. Understanding partition keys in Azure Cosmos DB
      1. Why are partition keys valuable?
      2. Creating partition keys in .NET
      3. Best practices for using partition keys
    5. Exploring indexes in Azure Cosmos DB
      1. What are indexes?
      2. Why are indexes valuable?
      3. How to create indexes in .NET
      4. Best practices for using indexes
    6. Creating an Azure Cosmos DB database with the Azure CLI
    7. Querying and managing data in Azure Cosmos DB with the .NET SDK
      1. Querying data with the .NET SDK
      2. Using the SQL API
      3. Using LINQ
      4. Managing data with the .NET SDK
      5. Inserting data
      6. Updating data
      7. Deleting data
      8. Managing containers and databases
      9. Using the change feed
    8. Developing with Azure Cosmos DB
      1. Working with the .NET SDK
      2. Cosmos DB cold start problem
      3. Gateway versus direct mode connection
      4. Designing efficient data access patterns
      5. Considerations for performance and cost optimization
      6. Cost optimization
      7. Performance optimization
      8. Monitoring and performance tuning
    9. Summary
  17. Part 4: Messaging Mechanisms and Security
  18. Chapter 9: Utilizing Azure App Configuration
    1. Technical requirements
    2. Introducing Azure App Configuration
      1. Creating Azure App Configuration instance using the Azure portal
      2. Creating an Azure App Configuration instance using the Azure CLI
    3. Using Azure App Configuration in ASP.NET Core
    4. Dynamic configuration in ASP.NET Core
    5. Exploring feature toggles
      1. Implementing feature toggles from ASP.NET Core
      2. Using features from Azure App Configuration
    6. Summary
  19. Chapter 10: Processing Data with Azure Event Hubs
    1. Key concepts of Azure Event Hubs
      1. Events
      2. Event producers
      3. Event consumers
      4. Partitions
      5. Event Hubs namespaces
      6. Event ingestion and processing with Azure Event Hubs
      7. Scaling and availability in Azure Event Hubs
      8. Integrating Azure Event Hubs in the Azure ecosystem
    2. How Azure Event Hubs handles event ingestion
    3. Event storage and retention
      1. How Azure Event Hubs handles larger retention periods
      2. Fault tolerance and reliability
      3. Replication, high availability, and disaster recovery capabilities
    4. Setting up an Azure Event Hubs client in .NET
      1. Establishing a connection to an Event Hub
      2. Sending events to an event hub using the Event Hubs client
      3. Processing and handling events in a .NET application
    5. Routing, load balancing, and error handling
      1. Routing events to different partitions
      2. Balancing the load among multiple consumers
      3. Handling failures
      4. Understanding common failure scenarios in event processing
    6. Dead-lettering and handling poison messages
      1. Dead-lettering
      2. Handling poison messages
    7. Monitoring and alerting for failures and errors
      1. Azure Monitor
      2. Azure alerts
    8. Building robust applications with Azure Event Hubs
      1. Configuring access control and permissions for Event Hubs
      2. Using Azure Active Directory for authentication and authorization
      3. Encrypting data in transit and at rest
      4. Best practices to secure Event Hubs in a production environment
    9. Scaling and performance optimization
      1. Techniques to scale event hubs horizontally and vertically
    10. Summary
  20. Chapter 11: Designing Ready-Made Solutions with Azure Service Bus
    1. Understanding Azure Service Bus
      1. Message queues
      2. Topics and subscriptions
      3. Dead-letter queues
      4. Scheduled delivery
      5. The unique capabilities of Azure Service Bus
      6. Azure Service Bus versus other messaging technologies
    2. Considerations for designing enterprise solutions using Azure Service Bus
      1. Message patterns and communication models
      2. Scalability and throughput requirements
      3. Message durability and reliability
      4. Security and access control considerations
      5. Monitoring, diagnostics, and error handling
    3. Delving into topics and subscriptions
      1. Publishing and subscribing to topics
      2. Filters and rules for message routing
      3. The Competing Consumers pattern with subscriptions
      4. The fan-in and fan-out pattern
      5. Handling dead-letter messages
    4. Scaling and high availability in Azure Service Bus
      1. Scaling out and partitioning with Service Bus
      2. Load balancing and message distribution across namespaces
      3. Availability and disaster recovery considerations
      4. Using geographic redundancy and zone redundancy
    5. Optimizing Service Bus performance
      1. Design considerations for optimal performance
      2. Azure Service Bus best practices
      3. Cost management and pricing tiers
    6. Integrating Azure Service Bus with enterprise architectures
      1. Service Bus and event-driven architectures
      2. Real-world use cases and examples of Azure service bus integration
      3. Message versioning
    7. Creating an Azure Service Bus via the CLI
    8. Summary
  21. Chapter 12: Enhancing Data Protection with Azure Key Vault
    1. Technical requirements
    2. Introducing Azure Key Vault
    3. Creating an Azure Key Vault service
      1. Creating a key vault from the Azure portal
      2. Creating a key vault using the Azure CLI
    4. Setting up secrets, certificates, and keys
      1. Configuring RBAC permissions for Azure Key Vault
      2. Setting and retrieving a secret from Azure Key Vault
      3. Setting and retrieving a certificate from Azure Key Vault
      4. Setting and retrieving a key from Azure Key Vault
    5. Setting up authentication in Azure Key Vault
      1. Using a system-assigned identity
      2. Using a user-assigned managed identity
    6. Summary
  22. Chapter 13: Managing Access with Azure Active Directory B2C
    1. Technical requirements
    2. Introducing Azure AD B2C
      1. Different authentication flows
    3. Creating and configuring Azure AD B2C instance
      1. Creating an Azure AD B2C resource
      2. Registering a web application to Azure AD B2C
      3. Creating and configuring user flows
    4. Using Azure AD B2C in ASP.NET Core applications
    5. Different types of tokens
    6. Using Azure AD B2C in single-page applications
    7. Configuring social media login with Azure AD B2C
    8. Summary
  23. Index
    1. Why subscribe?
  24. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: A Developer's Guide to .NET in Azure
  • Author(s): Anuraj Parameswaran, Tamir Al Balkhi
  • Release date: October 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781837633012