GithubHelp home page GithubHelp logo

azure-samples / network-go-manage-network-security-group Goto Github PK

View Code? Open in Web Editor NEW
1.0 19.0 5.0 12 KB

Basic operations with Azure ARM network security groups

License: MIT License

Go 100.00%
network-security-groups azure

network-go-manage-network-security-group's Introduction

services platforms author
network Go marstr

Getting Started with Network - Manage Network Security Groups - in Go

Setting Up Your Machine

Downloads and Subscriptions

This sample assumes that you have an Azure subscription to target. If you do not already have one, you can get started for free at azure.microsoft.com.

You should also have a machine with Go 1.9 or higher installed.

System Environment

You will need to have the following environment variables set when executing this sample:

  • AZURE_SUBSCRIPTION_ID
  • AZURE_TENANT_ID
  • AZURE_CLIENT_ID
  • AZURE_CLIENT_SECRET

There's a lot of great documentation that can be found on populating those variables, getting starting with Service Principals, and accessing your subscription programaticly. Here are some of the sites that will be best at helping you get started:

Acquiring & Running

There are a couple of options for acquiring and running this sample.

  1. Using go get...:

    This is fastest and easiest, but will clutter your PATH. Simply run the following command:

    go get -u github.com/Azure-Samples/network-go-manage-network-security-group

    Once go get has finished running, you should be able to execute the command:

    network-go-manage-network-security-group

    If you make tweaks to the source code for the sample, you will need to re-build and optionally re-install the sample.

  2. Clone & Build:

    Using this option will require using glide, but doesn't add anything into your Go bin directory. For this option, take the following steps:

    • Install glide if it's not already present on your machine.
    • git clone [email protected]:Azure-Samples/network-go-manage-network-security-group.git
    • cd network-go-manage-network-security-group
    • glide install
    • `go run ./sample.go

Using either of the above options, your subscription may have restrictions on which Locations are eligible for the operations taken by this sample. If you run into trouble, you can change the region which is targeted by the global variable sampleLocation. At the time of this writing, the definition is on line 47.

Execution Flags

For convenience of the ability to test the network security groups that were craeted by this sample, there are a couple of ways to delay cleanup.

  • -pause waits for human acknowledgement before deleting the resource group that was created.
  • -delay {uint} waits a specified number of seconds before deleting the resource group that was created. If you don't care to see the output messages, you can pass the flag -quiet.

What This Sample Does

  1. Create a Resource Group to encapsulate everything created by this sample.
  2. Create a Virtual Network that will host the subjects of this sample.
  3. Create two Security Groups that initially have no rules to enforce.
  4. Create two Subnets, and associate them with the previously created Security Groups.
  5. Create a set of SecurityRules for each Subnet that hypothetically would give appropriate access.
  6. Clean up. Delete all of the items that were created above.

network-go-manage-network-security-group's People

Contributors

marstr avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.