Book Image

Windows PowerShell for .NET Developers - Second Edition - Second Edition

Book Image

Windows PowerShell for .NET Developers - Second Edition - Second Edition

Overview of this book

Windows PowerShell 5.0 for .NET Developers is your self-start guide to performing automation using Windows PowerShell. This book will help you to understand the PowerShell syntax and grammar and will also teach you techniques to remove the rough edges of manual deployments. Packed with PowerShell scripts and sample C# codes to automate tasks, it also includes real-world scenarios such as administrating office servers to help you save time and perform deployments swiftly and efficiently. The book begins with the Windows PowerShell basics, explores the significant features of Windows Management Framework 5.0, covers the basic concepts of Desired State Configuration and the importance of idempotent deployments. By the end of the book, you will have a good understanding of Windows PowerShell’s features and will be able to automate your tasks and manage configuration effectively.
Table of Contents (13 chapters)

Exploring the REST API


REST is the abbreviated form of Representational State Transfers. Using this, we can connect to the server from a client over HTTP and manipulate resources. In short, REST is a software architectural model commonly used on the World Wide Web.

Take a look at the help document of the Invoke-RestMethod method which sends an HTTP or HTTPS request to a RESTful web service.

Using the Azure REST API in PowerShell

Managing Azure is easy using the REST API and PowerShell. No need for employees clicking Azure machines to retrieve information from the Azure portal. Many IT professionals use the Azure module to automate tasks in Azure, such as building, restarting, and removing the server, and many more. Before we start using the REST API, let's explore a few Azure cmdlets.

As with any other module, we need to import the Azure module as well. A few errors in the Azure module might be misleading, but we can safely ignore these for now.

The first step is to get the Azure publish settings...