Deploy using the Azure CLI

Overview

The Azure CLI has an extension to be used for management of NGINXaaS for Azure deployments whether that be locally or in continuous integration pipelines. This document links you to information around basic NGINXaaS extension usage.

Prerequisites

  • Confirm that you meet the NGINXaaS Prerequisites.

  • Install Azure CLI version 2.59.0 or greater: Azure CLI Installation.

  • Log into your Azure account through the CLI: Azure CLI Authentication.

  • Install the NGINXaaS for Azure extension:

    Note:
    The extension will automatically install the first time you run an az nginx command.
    az extension add --name nginx
    
See Also:
See the NGINXaaS for Azure CLI reference for a complete list of NGINXaaS CLI commands.

Create a deployment

To create an NGINXaaS for Azure resource use the az nginx deployment create command:

az nginx deployment create --deployment-name
                           --resource-group
                           [--auto-upgrade-profile]
                           [--enable-diagnostics {0, 1, f, false, n, no, t, true, y, yes}]
                           [--identity]
                           [--location]
                           [--logging]
                           [--network-profile]
                           [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                           [--scaling-properties]
                           [--sku]
                           [--tags]
                           [--user-profile]

Examples

  • Create a deployment with public IP:

    az nginx deployment create --name myDeployment --resource-group \
       myResourceGroup --location eastus2 --sku name="standard_Monthly" \
       --network-profile front-end-ip-configuration="{public-ip-addresses:[{id:/subscriptions/mySubscription/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIP}]}" \
       network-interface-configuration="{subnet-id:/subscriptions/mySubscription/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet}"
    
  • Create a deployment with private IP:

    az nginx deployment create --name myDeployment --resource-group \
       myResourceGroup --location eastus2 --sku \
       name="standard_Monthly" --network-profile \
       front-end-ip-configuration="{private-ip-addresses:[{private-ip-allocation-method:Static,subnet-id:/subscriptions/mySubscription/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet,private-ip-address:10.0.0.2}]}" \
       network-interface-configuration="{subnet-id:/subscriptions/mySubscription/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet}"
    
    az nginx deployment create --name myDeployment --resource-group \
       myResourceGroup --location eastus2 --sku \
       name="standard_Monthly" --network-profile \
       front-end-ip-configuration="{private-ip-addresses:[{private-ip-allocation-method:Dynamic,subnet-id:/subscriptions/mySubscription/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet,private-ip-address:10.0.0.2}]}" \
       network-interface-configuration="{subnet-id:/subscriptions/mySubscription/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVNet/subnets/mySubnet}"
    
  • Create a deployment with managed identity, storage account and scaling:

    az nginx deployment create --deployment-name myDeployment --resource-group \
       myResourceGroup --location eastus2 --sku name=standard_Monthly \
       --network-profile \
       network-interface-configuration='{subnet-id:/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet-azclitest/subnets/mySubnet}' \
       front-end-ip-configuration='{public-ip-addresses:[{id:/subscriptions/subscriptionId/resourceGroups/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/myPublicIP}]}' \
       --identity '{"type":"UserAssigned","userAssignedIdentities":{"/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myManagedIdentity":{}}}' \
       --logging storage-account='{"account-name":"myStorageAccount","container-name":"myContainer"}' \
       --scaling-properties capacity=10
    

See the Azure CLI Deployment Create Documentation for more details on the required and optional parameters.

Update a deployment

To update an NGINXaaS for Azure resource use the az nginx deployment update command:

az nginx deployment update [--add]
                           [--auto-upgrade-profile]
                           [--deployment-name]
                           [--enable-diagnostics {0, 1, f, false, n, no, t, true, y, yes}]
                           [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                           [--identity]
                           [--ids]
                           [--location]
                           [--logging]
                           [--network-profile]
                           [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                           [--remove]
                           [--resource-group]
                           [--scaling-properties]
                           [--set]
                           [--sku]
                           [--subscription]
                           [--tags]
                           [--user-profile]

Example

  • Update tags and enable diagnostics support for a deployment:

    az nginx deployment update --name myDeployment --resource-group \
    myResourceGroup --location eastus2 --tags tag1="value1" \
    tag2="value2" --enable-diagnostics
    

See the Azure CLI Deployment Update Documentation for more details on the required and optional parameters.

Delete a deployment

Use the az nginx deployment delete command to delete an NGINXaaS for Azure resource:

az nginx deployment delete [--deployment-name]
                           [--ids]
                           [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                           [--resource-group]
                           [--subscription]
                           [--yes]

Example

  • Delete a deployment:

    az nginx deployment delete --name myDeployment \
       --resource-group myResourceGroup
    

See the Azure CLI Deployment Delete Documentation for more details on the required and optional parameters.

Additional resources