MCPcopy Index your code
hub / github.com/Azure-Samples/azure-sdk-for-go-samples

github.com/Azure-Samples/azure-sdk-for-go-samples @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
876 symbols 2,175 edges 135 files 6 documented · 1%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

languages: - go products: - azure page_type: sample description: "A collection of samples showing how to use the Azure SDK for Go."


Azure SDK for Go Samples

This repo contains a collection of sample usages of the new version of Azure/azure-sdk-for-go. All the samples are placed under sdk folder and the folder structures are corresponding to the service packages under the /sdk directory of the Azure/azure-sdk-for-go repo. You can refer to this doc to get started with Azure SDK for Go.

For general SDK help, please refer to the SDK README.

To run tests

Prerequisites

You will need Go 1.18 and latest version of resource management modules.

You will need to authenticate to Azure either by using Azure CLI to sign in or setting environment variables.

Using Azure CLI to Sign In

You could easily use az login in command line to sign in to Azure via your default browser. Detail instructions can be found in Sign in with Azure CLI.

Setting Environment Variables

If your code is going to run in a none-user-interactive environment, you can also authenticate by setting environment variables as below.

You will need the following values to authenticate to Azure

  • Subscription ID
  • Client ID
  • Client Secret
  • Tenant ID

These values can be obtained from the portal, here's the instructions:

  • Get Subscription ID

    1. Login into your Azure account
    2. Select Subscriptions in the left sidebar
    3. Select whichever subscription is needed
    4. Click on Overview
    5. Copy the Subscription ID
  • Get Client ID / Client Secret / Tenant ID

    For information on how to get Client ID, Client Secret, and Tenant ID, please refer to this document

  • Setting Environment Variables

    After you obtained the values, you need to set the following values as your environment variables

    • AZURE_CLIENT_ID
    • AZURE_CLIENT_SECRET
    • AZURE_TENANT_ID
    • AZURE_SUBSCRIPTION_ID

    To set the following environment variables on your development system:

    Windows (Note: Administrator access is required)

    1. Open the Control Panel
    2. Click System Security, then System
    3. Click Advanced system settings on the left
    4. Inside the System Properties window, click the Environment Variables… button.
    5. Click on the property you would like to change, then click the Edit… button. If the property name is not listed, then click the New… button.

    Linux-based OS :

    export AZURE_CLIENT_ID="__CLIENT_ID__"
    export AZURE_CLIENT_SECRET="__CLIENT_SECRET__"
    export AZURE_TENANT_ID="__TENANT_ID__"
    export AZURE_SUBSCRIPTION_ID="__SUBSCRIPTION_ID__"
    

Run tests

  1. Clone the repository.

    git clone https://github.com/Azure-Samples/azure-sdk-for-go-samples.git 2. Set the environment variable.

``` # bash export AZURE_SUBSCRIPTION_ID= # If no value is set, the created resource will be deleted by default. # anything other than empty to keep the resources export KEEP_RESOURCE=1

# powershell $env:AZURE_SUBSCRIPTION_ID= $env:KEEP_RESOURCE=1 ```

  1. Choose one sample and run.

    cd azure-sdk-for-go-samples/sdk/resourcemanager/<service>/<single sample> go run main.go

    Resources

  2. SDK code is at Azure/azure-sdk-for-go.

  3. SDK docs are at godoc.org.
  4. SDK notifications are published via the Azure update feed.
  5. Azure API docs are at docs.microsoft.com/rest/api.
  6. General Azure docs are at docs.microsoft.com/azure.

License

This code is provided under the MIT license. See LICENSE for details.

Contribute

We welcome your contributions! For instructions and our code of conduct see CONTRIBUTING.md. And thank you!

Core symbols most depended-on inside this repo

createApiManagementService
called by 2
sdk/resourcemanager/apimanagement/deleted_service/main.go
readJson
called by 2
sdk/resourcemanager/resource/deployment/main.go
createApplicationType
called by 2
sdk/resourcemanager/servicefabric/applicationtype/main.go
createRecoveryServiceVault
called by 1
sdk/resourcemanager/recoveryservices/vault/main.go
getRecoveryServiceVault
called by 1
sdk/resourcemanager/recoveryservices/vault/main.go
createResourceGroup
called by 1
sdk/resourcemanager/recoveryservices/vault/main.go
cleanup
called by 1
sdk/resourcemanager/recoveryservices/vault/main.go
createRecoveryServiceVault
called by 1
sdk/resourcemanager/recoveryservices/vaultextendedinfo/main.go

Shape

Function 876

Languages

Go100%

Modules by API surface

sdk/resourcemanager/compute/create_vm/main.go19 symbols
sdk/resourcemanager/servicebus/disaster_recovery_config/main.go12 symbols
sdk/resourcemanager/storage/storageaccount/main.go11 symbols
sdk/resourcemanager/storage/blob/main.go11 symbols
sdk/resourcemanager/sql/job/main.go11 symbols
sdk/resourcemanager/appservice/staticsite/main.go10 symbols
sdk/resourcemanager/sql/vulnerability_assessment/main.go9 symbols
sdk/resourcemanager/sql/sync/main.go9 symbols
sdk/resourcemanager/keyvault/vault/main.go9 symbols
sdk/resourcemanager/eventhub/disaster_recovery_config/main.go9 symbols
sdk/resourcemanager/automation/job/main.go9 symbols
sdk/resourcemanager/appservice/webapp/main.go9 symbols

For agents

$ claude mcp add azure-sdk-for-go-samples \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page