Make calls to many of our API with a consistent interface using our PowerShell module.

Before you begin

  1. Make sure your contract includes access to the service (EdgeWorkers, Cloudlets, etc.) you want to use.
  2. Install or update to the latest version of PowerShell. For best performance, use v7 or higher.

Install

Install the Akamai PowerShell module using the built-in package manager or by cloning our module's repository.

PowerShell Gallery

Install through the PowerShell Gallery.

  1. Open a shell instance and install at the admin level or within the limit of your current permissions.

    # Admin/all users
    Install-Module AkamaiPowershell
    
    # Current user's scope
    Install-Module AkamaiPowershell -Scope CurrentUser
    
  2. Import our module.

    Import-Module AkamaiPowershell
    

    Your shell will throw a warning that our module includes unapproved verbs. This is because we've added in verbs specific to Akamai operations like Activate or Purge that aren't in the PowerShell-approved verb list.

    You can safely ignore this warning.

Github clone

Install using a clone of the module's GitHub repository.

  1. Open a shell instance, create or navigate to a preferred project directory, and clone the repository.

    git clone https://github.com/akamai/akamaipowershell.git
    

    This creates an akamaipowershell subdirectory.

  2. Import our module.

    Import-Module ./akamaipowershell
    

    ๐Ÿ“˜

    If you are on Powershell 5.1, you also need to specify the module file directly.

    Import-Module ./akamaipowershell/akamaipowershell.psm1

    Your shell will throw a warning that our module includes unapproved verbs. This is because we've added in verbs specific to Akamai operations like Activate or Purge that aren't in the PowerShell-approved verb list.

    You can safely ignore this warning.

Authenticate

Authentication credentials for the majority of our API use a hash-based message authentication code or HMAC-SHA-256 created through an API client. We recommend each member of your team use their own client set up locally to prevent accidental exposure of credentials.

If you're using the NetStorage Usage API, you also need an API key.

API clients

There are different types of API clients that grant access based on your need, role, or how many accounts you manage.

API client typeDescription
BasicAccess all API associated with your account without any specific configuration. Individual service read/write permissions are based on your role.
AdvancedConfigurable permissions to limit or narrow down scope of the API associated with your account.
ManagedConfigurable permissions that work for multiple accounts.

Create a basic API client

  1. Navigate to the Identity and Access Management section of Akamai Control Center and click Create API Client.

  2. Click Quick and then Download in the Credentials section.

  3. Open the downloaded file with a text editor and add [default] as a header above all text.

    [default]
    client_secret = C113nt53KR3TN6N90yVuAgICxIRwsObLi0E67/N8eRN=
    host = akab-h05tnam3wl42son7nktnlnnx-kbob3i3v.luna.akamaiapis.net
    access_token = akab-acc35t0k3nodujqunph3w7hzp7-gtm6ij
    client_token = akab-c113ntt0k3n4qtari252bfxxbsl-yvsdj
    
  4. Save your credentials as an EdgeGrid resource file named .edgerc in your local home directory.

    // Linux
    $ /home/{username}/.edgerc
    
    // MacOS
    $ /Users/{username}/.edgerc
    
    // Windows
    C:\Users\{username}\.edgerc
    

    If you choose to place your resource file in any other location or use a different heading:

    • Add the -EdgeRCFile parameter and provide the path to its location, ~/my.edgerc to your commands.
    • Use the -Section parameter and provide a value.

    ๐Ÿ“˜

    All functions in our module support EdgeRCFile, Section and AccountSwitchKey parameters except the NetStorage Usage API commands.

API keys

The NetStorage Usage API does not use an API client. To use the service, create or use an existing NetStorage upload account with HTTP API access and generate an API key.

  1. Navigate to the NetStorage Upload Accounts section of Akamai Control Center and click Add Upload Account to add a new account and provide the needed information.

  2. Choose the NetStorage HTTP CMS API tab from the Access Methods's content panel. Click Add HTTP API Key and then Yes to confirm. A valid API key is automatically generated and applied to your account.

  3. Create an authentication file located at ~/.akamai-cli/.netstorage/auth, and under a section heading of [default], add your API key and the:

    • ID of your upload account exactly as it appears in the UI
    • Storage group name
    • HTTP domain dame of the storage group
    • Upload directory CP code
    [default]
    key=ACC35sk3YT2ll1H4dXWx5itGhpc7FlSbvvOvky10
    id=exampleuploadaccountid
    group=X112233
    host=example.com
    cpcode= 1234567
    

    If you choose to place your resource file in any other location or use a different heading:

    • Add the AuthFile parameter to any NetStorage API command.
    • Use the -Section parameter and provide a value.

Account Switching

When managing multiple accounts using a managed API client, you need to associate your actions to a specific account with its switch key.

๐Ÿ“˜

Your API client must have access to the Identity Management API to use these commands.

  1. Find account keys with the List-IDMAccountSwitchKeys function.

    List-IDMAccountSwitchKeys -SearchString "My Account Name"
    
  2. Use a switch key with the -AccountSwitchKey to apply your actions to the identified account.

Reference

Similar to typical online PowerShell module help, clicking on the reference button above will take you to a list of the help files for our module's commands.

Help is arranged alphabetically by service and in standard REST API CRUD order.