Azure / ASE_automation_for_AP5GC

Single script that takes input parameters in an Excel file and creates the Infra setup on the ASE making it ready for AP5GC installation.
MIT License
3 stars 4 forks source link

About this script

This script streamlines and automates the process of preparing Azure Stack Edge (ASE) for use with Azure Private 5G Core ('AP5GC'). The script supports Azure Stack Edge Pro and Azure Stack Edge Pro 2, running ASE software versions 2309, 2312 and 2403 only. It supports singleton installations of AP5GC. Also, this does not support any Trunk vlan configuration on the ASE.

Actions performed by the script

  1. Takes in all input parameters (IP's, number of DNN's, subID, tenantID, ASE password, MTU, vlan, interface names etc) in a single Excel file from the 'Datafill' worksheet.
  2. A 'Diagram' worksheet in the same Excel is populated with the values from 'Datafill' worksheet to provide a pictoral view of the Private Network core infrastructure.
  3. Sets up the ASE with all the IP commissioning in Advanced Networking (vswitches, vnetworks) and Kubernetes sections.
  4. Adds the OID for your subscription to the ASE.
  5. Creates the Microsoft K8s cluster (Azure Kubernetes Service).
  6. Connects the Kubernetes cluster to Azure via Arc (Azure Kubernetes Arc).
  7. Adds the required extensions of networkfunction-operator and packet-core-monitor.
  8. Creates a custom location for the ASE.
  9. Creates an empty new Resource Group as a placeholder for AP5GC resources.
  10. Applies the steps in Azure Private 5G Core documentation: Commission the AKS cluster via automation.
  11. The inputs to be given in excel format & validations of input will be done as part of the script.

Prerequisites

  1. A Windows laptop. You will need Administrator rights over your machine. Make sure that Excel is installed.

  2. PowerShell 5.x. (Other versions of PowerShell are not supported.) You may already have it installed: run PowerShell from the Start menu and use the $PSVersionTable command to verify the version.

  3. The ImportExcel and Azure Resources (az.Resources) Powershell modules. To verify, run PowerShell as an Administrator and then execute the following:

    Get-Module -Name Az.Resources -list
    Get-Module -Name ImportExcel  -list

    If the module is installed, the version will be displayed; otherwise, no output is produced. To install them, run PowerShell as an Administrator and then execute the following, exiting and restarting your PowerShell session afterwards:

    Install-Module -Name Az.Resources -AllowClobber -Scope CurrentUser
    Install-Module -Name ImportExcel  -AllowClobber -Scope CurrentUser
  4. Remote execution support between your PC and ASE. Run PowerShell as an Administrator and execute: winrm quickconfig. If remote execution support is not already enabled, you will be prompted to enable it.

    If winrm returns errors regarding Public interfaces being used, change them to private: from your Powershell console run:

    Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

    Note: after using this script, you can disable remote execution via the commands:

    Stop-Service winrm
    Set-Service -Name winrm -StartupType Disabled
  5. Install the Azure CLI tools on your PC, following the instructions to install Azure CLI on Windows. We suggest choosing the 64-bit MSI installation.

  6. Azure: You will need access to the subscription used for your Azure Stack Edge device. You must have Ownership privileges on this subscription.

  7. Your Azure subscription should have been explicitly authorized by Microsoft for AP5GC usage, so that you can later deploy AP5GC (outside of scope here).

  8. You should create a Resource Group (RG) for the ASE, and ensure your have Owner permissions on it, before using the script.

Preparing to run the script

  1. Clone or download this repo to your laptop.
  2. Grant permission to run the script. Run PowerShell as an Administrator, navigate to where the script is present and unblock the script using:
    Unblock-File PowerShellBasedConfiguration.psm1
  3. In case your laptop does not have permissions to execute powershell scripts, the Set-ExecutionPolicy cmdlet changes PowerShell execution policies for Windows computers. Run this inside your PowerShell terminal:
    Set-ExecutionPolicy Unrestricted -Scope CurrentUser
  4. Complete all of the steps mentioned under Order and set up your Azure Stack Edge Pro device(s).
  5. Verify that your laptop has access to the ASE's IP address over the management/OAM port, for example, by pointing a web browser at the IP.
  6. Confirm that your ASE has Certificates generated, Activated and in the Kubernetes (Preview) section you have enabled the "an Azure Private MEC solution in your environment" option.
  7. IMPORTANT: After selecting "an Azure Private MEC solution in your environment", you might require to upgrade the ASE K8s firmware again before running the script if that box was unchecked.
  8. Check that on the Azure portal, under the ASE Resource, you do not have any unresolved prompts or warnings, such as recommendations to upgrade ASE software. If you do, please follow the steps to perform the necessary ASE firmware upgrades.

Running the script

  1. Fill in all your parameters in the Excel file: parameters_file_single_ASE_AP5GC.
  2. Save the file and close Excel.
  3. Open PowerShell as an Adminstrator, and navigate to the location of the script.
  4. In the same session, run: az login. Select the appropriate tenant ID in the browser pop up and sign in.
  5. Execute the PowerShell script:
    .\one_script_single_ASE.ps1

    (A browser prompt may request that you log in to your tenant - this is for the Az cmdlet.)

Typically, all the ASE resources should be deployed within 35-45 minutes.