Virtual Network

The following example will deploy a Resource Group and a simple Virtual Network into an Azure subscription.

---
Connection:
# Replace the TenantId and SubscriptionID with your values
  - Name: az-jd-sub1
    Azure: 
      Environment: AzureCloud
      TenantId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      Context:
        SubscriptionId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

# -------------------------------------------------------------------------------------------------------------------

azResourceGroup:
    # Mandatory
  - Name: rg-jdex-vnet
    ConnectionName: az-jd-sub1
    Location: uksouth
    # Optional
    Tag:
      CostCentre: '666'
      ProjectManager: 'Fred Smith'
    Lock:
      - Name: StopAccidentalDelete
        Level: CanNotDelete                         # CanNotDelete, ReadOnly
        Notes: 'stop deletion'

azVirtualNetwork:
    # Mandatory
  - Name: vnet-jdex-vnet
    ConnectionName: az-jd-sub1
    Location: uksouth
    AddressPrefix: '10.0.0.0/16'
    ResourceGroupName: rg-jdex-vnet
    # Optional
    Tag:
      CostCentre: '666'
      ProjectManager: 'Fred Smith'
    Lock:
      - Name: StopAccidentalDelete
        Level: CanNotDelete                         # CanNotDelete, ReadOnly
        Notes: 'stop deletion'

Copy the above into a new .yml file and substitute in your tenant and subscription ids.

Validation

Execute the following powershell command to validate your resources. You will be prompted to authenticate to Azure with a suitable Microsoft account. Please ensure the account you choose has the relevant permissions to check your resources.

Confirm-JDResource -Verbose -Type All -DeploymentFile "<filename>.yml"

The above command will validate the resources in the yaml file. The -Type parameter allows the execution of just part of a yaml file that may contain other resource types.

Deployment

Execute the following powershell command to deploy your resources. You will be prompted to authenticate to Azure with a suitable Microsoft account. Please ensure the account you choose has the relevant permissions to check your resources.

Deploy-JDResource -Verbose -Type All -DeploymentFile "<filename>.yml"

The above command will create all resource types in the yaml file. The -Type parameter allows the execution of just part of a yaml file that may contain other resource types.