vm

command
v0.0.0-...-ee5caf8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 13 Imported by: 0

README

Hybrid-Compute-GO-Create-VM

These samples demonstrate how to create Virtual Machines using the Azure SDK for Go on Azure Stack. The code provided shows how to do the following:

  • Create a resource group
  • Create a virtual network
  • Create a security group
  • Create a public IP
  • Create a network interface
  • Create a storage account
  • Create a virtual machine

To see the code to perform these operations, check out the main() function in app.go. Each operation is clearly labeled with a comment and a print function.

Running this sample

  1. Open a Powershell or Bash shell in ...\Hybrid-Golang-Samples\vm and enter the following command:

    go mod init vm
    
  2. Run the following to validate the go mod file with the required source code modules.

    go mod tidy
    
  3. Note that in order to run this sample, Canonial UbuntuServer 16.04-LTS image must be present in AzureStack market place. These can be downloaded from Azure and added to Platform Image Repository.

  4. Azure will force the use of SSH over password authentication if both were configured. The sample code also enforces SSH key pair authentication over password authentication. The password authentication will be used if the SSH key pair path does not exist. The VM admin username will be VMAdmin. To run the sample, do one of either:

    • Create an SSH key at %HOMEPATH%/.ssh/id_rsa.pub for SSH key pair authentication.
    go run app.go
    
    • Pass a string parameter as the VM admin password for password authentication.
    go run app.go <PASSWORD>
    
  5. Clean the resource group created during sample run.

    go run app.go clean
    

More information

Here are some helpful links:

If you don't have a Microsoft Azure subscription you can get a FREE trial account here.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL