2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-02 09:58:25 +00:00
restic/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/dns
Alexander Neumann 61cb1cc6f8 Update vendored dependencies
This includes github.com/kurin/blazer 0.2.0, which resolves #1291
2017-10-01 10:13:39 +02:00
..
paging Update vendored dependencies 2017-10-01 10:13:39 +02:00
create.go Update vendored dependencies 2017-10-01 10:13:39 +02:00
README.md Vendor dependencies for azure backend 2017-08-06 21:47:04 +02:00

Example Accessing the Azure DNS API

Prerequisites

  1. Create an Azure Resource Group. The code assumes delete-dns as the name: az group create -l westus -n delete-dns

  2. Create a Service Principal to access the resource group for example with the Azure CLI

az ad sp create-for-rbac --role contributor --scopes /subscriptions/<your subscription id>/resourceGroups/delete-dns

{
  "appId": "<appId>",
  "displayName": "<displayName>",
  "name": "<name>",
  "password": "<password>",
  "tenant": "<tenantId>"
}
  1. Set the following environment variables from the service principal
  • AZURE_CLIENT_ID=
  • AZURE_CLIENT_SECRET=
  • AZURE_SUBSCRIPTION_ID=
  • AZURE_TENANT_ID=

You can query the subscription id for your subscription with: az account show --query id

  1. Get the dependencies
  • go get github.com/Azure/go-autorest/autorest
  • go get github.com/Azure/go-autorest/autorest/azure
  • github.com/Azure/azure-sdk-for-go/arm

Run the sample

Execute with go run create.go