liveBook · Manning

Authentication

As explained in Practical Automation with PowerShell: Effective scripting from the console to the cloud

Authentication is the process of verifying an identity before granting access to a system or service.

Authentication verifies who is requesting access before an automation connects to a system, service, or API. Hybrid, cross-platform PowerShell workflows commonly combine credentials, API keys, or SSH keys, so authentication data must be handled deliberately rather than stored as plain text. section 4.2 section 9.3.1

Choose the authentication approach according to the connection being automated:

  • Use PowerShell Credential and SecureString objects when scripts require account credentials or other sensitive values. section 4.2
  • Prefer SSH key-based authentication for unattended remoting; protect the private key, publish the public key on the server, and use ssh-agent when appropriate. section 5.4.2
  • Use API keys when a REST service requires the caller to identify itself, passing the key with the request parameters or body defined by that API. section 9.3.1
  • Validate the remote SSH host separately from user authentication by confirming its host key and retaining it in known_hosts. section 5.4.2

Authenticated geolocation request

Retrieve the public IP, place the API key and IP address into a hashtable, and pass it to Invoke-RestMethod. The returned location can then populate an operational document or report.

Figure 5.6 How SSH remote execution works with key pair authentication

Shows how an SSH client uses a private/public key pair to authenticate remote PowerShell execution. section 5.4.2

How Practical Automation with PowerShell: Effective scripting from the console to the cloud covers it

How deep it goes
Explains credential objects, SSH key pairs, host verification, and API request parameters, while deferring provider-specific authentication schemes.
Examples
Demonstrates SSH key setup, Invoke-Command remoting, and a geo.ipify request that writes location data to Word.
What it assumes
Assumes PowerShell scripting and basic remote-service usage, while introducing SecureString, SSH key pairs, known hosts, and API-key parameters.
What you can do after
Apply it via PowerShell credentials, SSH keys, or API-key request bodies when automating authenticated connections.
How it connects
Connects SecureString, Credential objects, SSH, public-key cryptography, known hosts, API keys, and REST APIs.

Also explained in

Compare how 34 books explain authentication →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Practical Automation with PowerShell: Effective scripting from the console to the cloud. The section links point to the parts of the book it draws on.