The goal of hybrid samples is to provide a library of code snippets for common operations in Azure Stack via the Go SDK. Currently "compute", "network", "resource", and "storage" services are supported on Azure Stack. Hybrid sample code is organized by snippet type and is placed in "hybrid" folder in the supported services folders.
Note: Device authentication is not been enabled for Hybrid samples.
-
Set the following environment variables (those marked * are required). Use the following instructions to find or create these values if necessary.
AZURE_SUBSCRIPTION_ID
*AZURE_TENANT_ID
*AZURE_CLIENT_ID
*AZURE_CLIENT_SECRET
*AZURE_LOCATION
*AZURE_ENVIRONMENT
*AZURE_RESOURCE_GROUP_NAME
AZURE_SAMPLES_KEEP_RESOURCES
Using the Azure CLI, you can get your subscription ID by running
az account list
. You can check your tenant ID and get a client ID and secret by runningaz ad sp create-for-rbac -n "<yourAppName>"
.Using the Azure CLI, you can get your ARM endpoint and storage suffix by running
az cloud show
.If
AZURE_RESOURCE_GROUP_NAME
isn't specified a random name will be used.If
AZURE_KEEP_SAMPLE_RESOURCES
is set to1
tests won't clean up resources they create when done. This can be helpful if you want to further experiment with those resources.NOTE: the environment variables are listed in .env.tpl so you can copy that to .env (e.g.
cp .env.tpl .env
) and update for convenience. The samples pick up environment variables from .env files automatically. -
Run
dep ensure
to get dependencies. -
Run tests with
go test
as follows:- To run individual samples, refer to that folder, e.g.
go test ./storage/hybrid/
,go test ./network/hybrid/
.- If you use a .env file, copy it into the folder first, e.g.
cp .env ./network/hybrid/
.
- If you use a .env file, copy it into the folder first, e.g.
- To run individual samples, refer to that folder, e.g.
- SDK code is at [Azure/azure-sdk-for-go][].
- SDK docs are at godoc.org.
- SDK notifications are published via the [Azure update feed][].
- Azure API docs are at docs.microsoft.com/rest/api.
- General Azure docs are at docs.microsoft.com/azure.
This code is provided under the MIT license. See LICENSE for details.
We welcome your contributions! For instructions and our code of conduct see CONTRIBUTING.md. And thank you!