Skip to end of banner
Go to start of banner

Publish EmpowerID Microservice to Azure Using PowerShell

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

After you have developed and tested a Microservice in your local environment. You will have to publish the microservice to azure to deploy the necessary files.

Publishing the microservice using PowerShell requires you to have the appropriate ZIP file for the microservice. Once you have build and published the microservice locally, you can find the deployment zip of your microservices in ..\EmpowerID\WFS\_microservices folder.

Publish the microservice using PowerShell

  1. Copy the below PowerShell script into the text editor of your choice and save it as zipdeploy_appService.ps1.

    param(
        $pubProfileFilePath
        ,$zipFilePath
    )
    
    $ErrorActionPreference = "Stop"
    
    $pubProfile = [xml](gc $pubProfileFilePath)
    $zipPubProfile = $pubProfile.publishData.publishProfile | where { $_.publishMethod -eq "zipdeploy" }
    
    $userAgent = "powershell/1.0"
    $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $zipPubProfile.userName, $zipPubProfile.userPWD)))
    $zipdeployUrl = "https://$($zipPubProfile.publishUrl)/api/zipdeploy"
    $deploymentsUrl = "https://$($zipPubProfile.publishUrl)/api/deployments"
    
    Invoke-RestMethod -Uri $zipdeployUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method Post -InFile $zipFilePath
    
    Invoke-RestMethod -Uri $deploymentsUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method Get

  2. Open an administrative PowerShell session.

  3. Navigate to the directory where you saved the script and execute the script, passing in the values of the pubProfilePath and zipFilePath parameters via the command line, where the value of pubProfilePath is the path to the App Service Publisher Profile Settings file you downloaded from Azure, and the value of zipFilePath is the path to the microservice ZIP file you developed.

    The command to execute the script should look similar to that shown in the below image.

The Microservice is now published to your app service.

IN THIS ARTICLE

  • No labels