apiVersion: compute.azure.com/v1api20220301
kind: VirtualMachine
metadata:
  name: vm-linux
  namespace: winfv
spec:
  location: {{.Env.AZURE_LOCATION}}
  owner:
    name: {{.Env.AZURE_RESOURCE_GROUP}}
  hardwareProfile:
    vmSize: Standard_D4s_v3
  networkProfile:
    networkInterfaces:
      - reference:
          group: network.azure.com
          kind: NetworkInterface
          name: nic-linux
  osProfile:
    computerName: winfv-linux
    adminUsername: winfv
    adminPassword:
      key: password
      name: winfv-secret-windows
    linuxConfiguration:
      disablePasswordAuthentication: true
      ssh:
        publicKeys:
          - keyData: {{.Env.PUBLIC_KEY}}
            path: /home/winfv/.ssh/authorized_keys
  storageProfile:
    imageReference:
      publisher: Canonical
      offer: 0001-com-ubuntu-server-jammy
      sku: 22_04-lts
      version: latest
    osDisk:
      createOption: FromImage
      managedDisk:
        storageAccountType: Premium_LRS
---
apiVersion: compute.azure.com/v1api20220301
kind: VirtualMachinesExtension
metadata:
  name: vm-linux-customextension
  namespace: winfv
spec:
  location: {{.Env.AZURE_LOCATION}}
  owner:
    name: vm-linux
  publisher: Microsoft.Azure.Extensions
  type: CustomScript
  typeHandlerVersion: "2.0"
  settings:
    commandToExecute: /bin/bash -c "echo hello winfv"
---
apiVersion: compute.azure.com/v1api20220301
kind: VirtualMachinesExtension
metadata:
  name: vm-linux-docker
  namespace: winfv
spec:
  location: {{.Env.AZURE_LOCATION}}
  owner:
    name: vm-linux
  publisher: Microsoft.Azure.Extensions
  type: DockerExtension
  typeHandlerVersion: "1.0"
  autoUpgradeMinorVersion: true
---
apiVersion: network.azure.com/v1api20240301
kind: NetworkInterface
metadata:
  name: nic-linux
  namespace: winfv
spec:
  location: {{.Env.AZURE_LOCATION}}
  owner:
    name: {{.Env.AZURE_RESOURCE_GROUP}}
  networkSecurityGroup:
    reference:
      group: network.azure.com
      kind: NetworkSecurityGroup
      name: winfv-sg
  ipConfigurations:
    - name: ipconfig-linux
      subnet:
        reference:
          group: network.azure.com
          kind: VirtualNetworksSubnet
          name: subnet-winfv
      publicIPAddress:
        reference:
          group: network.azure.com
          kind: PublicIPAddress
          name: pip-linux
---
apiVersion: network.azure.com/v1api20240301
kind: PublicIPAddress
metadata:
  name: pip-linux
  namespace: winfv
spec:
  location: {{.Env.AZURE_LOCATION}}
  owner:
    name: {{.Env.AZURE_RESOURCE_GROUP}}
  publicIPAllocationMethod: Static
  sku:
    name: Standard
