فهرست منبع

Merge pull request #1427 from duncan485/develop

Support MSI authentication for Azure by always returning config values if secret not found
Sean Holcomb 3 سال پیش
والد
کامیت
c07cd7f739
1فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 8 2
      pkg/cloud/azureprovider.go

+ 8 - 2
pkg/cloud/azureprovider.go

@@ -531,9 +531,15 @@ func (az *Azure) getAzureRateCardAuth(forceReload bool, cp *CustomPricing) (subs
 		tenantID = cp.AzureTenantID
 		return
 	}
-
-	// 3. Empty values
+	// 3. Check if AzureSubscriptionID is set in config (set though endpoint)
+	// MSI credentials will be attempted if the subscription ID is set, but clientID, clientSecret and tenantID are not
+	if cp.AzureSubscriptionID != "" {
+		subscriptionID = cp.AzureSubscriptionID
+		return
+	}
+	// 4. Empty values
 	return "", "", "", ""
+
 }
 
 // GetAzureStorageConfig retrieves storage config from secret and sets default values