MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / initializeAzureClients

Function initializeAzureClients

src/cmd/linuxkit/azure.go:63–95  ·  view source on GitHub ↗
(subscriptionID, tenantID, clientID, clientSecret string)

Source from the content-addressed store, hash-verified

61)
62
63func initializeAzureClients(subscriptionID, tenantID, clientID, clientSecret string) {
64 oAuthConfig, err := adal.NewOAuthConfig(defaultActiveDirectoryEndpoint, tenantID)
65 if err != nil {
66 log.Fatalf("Cannot get oAuth configuration: %v", err)
67 }
68
69 token, err := adal.NewServicePrincipalToken(*oAuthConfig, clientID, clientSecret, defaultResourceManagerEndpoint)
70 if err != nil {
71 log.Fatalf("Cannot get service principal token: %v", err)
72 }
73
74 groupsClient = resources.NewGroupsClient(subscriptionID)
75 groupsClient.Authorizer = autorest.NewBearerAuthorizer(token)
76
77 accountsClient = storage.NewAccountsClient(subscriptionID)
78 accountsClient.Authorizer = autorest.NewBearerAuthorizer(token)
79
80 virtualNetworksClient = network.NewVirtualNetworksClient(subscriptionID)
81 virtualNetworksClient.Authorizer = autorest.NewBearerAuthorizer(token)
82
83 subnetsClient = network.NewSubnetsClient(subscriptionID)
84 subnetsClient.Authorizer = autorest.NewBearerAuthorizer(token)
85
86 publicIPAddressesClient = network.NewPublicIPAddressesClient(subscriptionID)
87 publicIPAddressesClient.Authorizer = autorest.NewBearerAuthorizer(token)
88
89 interfacesClient = network.NewInterfacesClient(subscriptionID)
90 interfacesClient.Authorizer = autorest.NewBearerAuthorizer(token)
91
92 virtualMachinesClient = compute.NewVirtualMachinesClient(subscriptionID)
93 virtualMachinesClient.Authorizer = autorest.NewBearerAuthorizer(token)
94
95}
96
97func createResourceGroup(resourceGroupName, location string) *resources.Group {
98 fmt.Printf("Creating resource group in %s\n", location)

Callers 2

pushAzureCmdFunction · 0.85
runAzureCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected