MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetAzureConnectionConfig

Function GetAzureConnectionConfig

backend/plugin/db/util/connection.go:97–111  ·  view source on GitHub ↗
(connCfg db.ConnectionConfig)

Source from the content-addressed store, hash-verified

95}
96
97func GetAzureConnectionConfig(connCfg db.ConnectionConfig) (azcore.TokenCredential, error) {
98 if azureCredential := connCfg.DataSource.GetAzureCredential(); azureCredential != nil {
99 c, err := azidentity.NewClientSecretCredential(azureCredential.TenantId, azureCredential.ClientId, azureCredential.ClientSecret, nil)
100 if err != nil {
101 return nil, errors.Wrapf(err, "failed to create client secret credential")
102 }
103 return c, nil
104 }
105
106 c, err := azidentity.NewDefaultAzureCredential(nil)
107 if err != nil {
108 return nil, errors.Wrapf(err, "failed to found default Azure credential")
109 }
110 return c, nil
111}

Callers 1

OpenMethod · 0.92

Calls 1

GetAzureCredentialMethod · 0.45

Tested by

no test coverage detected