package
0.2.0
Repository: https://github.com/virtual-kubelet/azure-aci.git
Documentation: pkg.go.dev

# README

A half-baked SDK for Azure in Go

This is a half-baked (ie. only provides what we needed) SDK for Azure in Go.

Authentication

Use an authentication file

This SDK also supports authentication with a JSON file containing credentials for the service principal. In the Azure CLI, you can create a service principal and its authentication file with this command:

az ad sp create-for-rbac --sdk-auth > mycredentials.json

Save this file in a secure location on your system where your code can read it. Set an environment variable with the full path to the file:

export AZURE_AUTH_LOCATION=/secure/location/mycredentials.json
$env:AZURE_AUTH_LOCATION= "/secure/location/mycredentials.json"

The file looks like this, in case you want to create it yourself:

{
    "clientId": "<your service principal client ID>",
    "clientSecret": "your service principal client secret",
    "subscriptionId": "<your Azure Subsription ID>",
    "tenantId": "<your tenant ID>",
    "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
    "resourceManagerEndpointUrl": "https://management.azure.com/",
    "activeDirectoryGraphResourceId": "https://graph.windows.net/",
    "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
    "galleryEndpointUrl": "https://gallery.azure.com/",
    "managementEndpointUrl": "https://management.core.windows.net/"
}

Log Analytics support

Log Analytics is supported through environment variables:

  • LOG_ANALYTICS_KEY
  • LOG_ANALYTICS_ID

You can also specify a file with these values and specify the path to it in the LOG_ANALYTICS_AUTH_LOCATION:

export LOG_ANALYTICS_AUTH_LOCATION=/secure/location/loganalytics.json
$env:LOG_ANALYTICS_AUTH_LOCATION= "/secure/location/loganalytics.json"

The file should look like this:

{
    "workspaceID": "<YOUR_LOG_ANALYTICS_WORKSPACE_ID>",
    "workspaceKey": "<YOUR_LOG_ANALYTICS_WORKSPACE_KEY>"
}

# Packages

Package aci provides tools for interacting with the Azure Container Instances API.
Package api contains the common code shared by all Azure API libraries.
No description provided by the author
Package resourcegroups provides tools for interacting with the Azure Resource Manager resource groups API.

# Functions

NewAuthentication returns an authentication struct from user provided credentials.
NewAuthenticationFromFile returns an authentication struct from file path.
NewClient creates a new Azure API client from an Authentication struct and BaseURI.

# Constants

EnvironmentFilepathName defines the name of the environment variable containing the path to the file to be used to populate the Azure Environment.

# Variables

ChinaCloud is the cloud environment operated in China.
GermanCloud is the cloud environment operated in Germany.
PublicCloud is the default public Azure cloud environment.
USGovernmentCloud is the cloud environment for the US Government.

# Structs

Authentication represents the authentication file for Azure.
BearerAuthorizer implements the bearer authorization.
Client represents authentication details and cloud specific parameters for Azure Resource Manager clients.
Environment represents a set of endpoints for each of Azure's Clouds.