You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// GetServicePrincipalToken creates a new service principal token based on the configuration
77
+
// GetServicePrincipalToken creates a new service principal token based on the configuration.
78
+
//
79
+
// By default, the cluster and its network resources are deployed in the same AAD Tenant and Subscription,
80
+
// and all azure clients use this method to fetch Service Principal Token.
81
+
//
82
+
// If NetworkResourceTenantID and NetworkResourceSubscriptionID are specified to have different values than TenantID and SubscriptionID, network resources are deployed in different AAD Tenant and Subscription than those for the cluster,
83
+
// than only azure clients except VM/VMSS and network resource ones use this method to fetch Token.
84
+
// For tokens for VM/VMSS and network resource ones, please check GetMultiTenantServicePrincipalToken and GetNetworkResourceServicePrincipalToken.
// GetMultiTenantServicePrincipalToken is used when (and only when) NetworkResourceTenantID and NetworkResourceSubscriptionID are specified to have different values than TenantID and SubscriptionID.
147
+
//
148
+
// In that scenario, network resources are deployed in different AAD Tenant and Subscription than those for the cluster,
149
+
// and this method creates a new multi-tenant service principal token based on the configuration.
150
+
//
151
+
// PrimaryToken of the returned multi-tenant token is for the AAD Tenant specified by TenantID, and AuxiliaryToken of the returned multi-tenant token is for the AAD Tenant specified by NetworkResourceTenantID.
152
+
//
153
+
// Azure VM/VMSS clients use this multi-tenant token, in order to operate those VM/VMSS in AAD Tenant specified by TenantID, and meanwhile in their payload they are referencing network resources (e.g. Load Balancer, Network Security Group, etc.) in AAD Tenant specified by NetworkResourceTenantID.
returnnil, fmt.Errorf("AAD Application client certificate authentication is not supported in getting multi-tenant service principal token")
177
+
}
178
+
179
+
returnnil, ErrorNoAuth
180
+
}
181
+
182
+
// GetNetworkResourceServicePrincipalToken is used when (and only when) NetworkResourceTenantID and NetworkResourceSubscriptionID are specified to have different values than TenantID and SubscriptionID.
183
+
//
184
+
// In that scenario, network resources are deployed in different AAD Tenant and Subscription than those for the cluster,
185
+
// and this method creates a new service principal token for network resources tenant based on the configuration.
186
+
//
187
+
// Azure network resource (Load Balancer, Public IP, Route Table, Network Security Group and their sub level resources) clients use this multi-tenant token, in order to operate resources in AAD Tenant specified by NetworkResourceTenantID.
returnnil, fmt.Errorf("AAD Application client certificate authentication is not supported in getting network resources service principal token")
210
+
}
211
+
212
+
returnnil, ErrorNoAuth
213
+
}
214
+
135
215
// ParseAzureEnvironment returns the azure environment.
136
216
// If 'resourceManagerEndpoint' is set, the environment is computed by quering the cloud's resource manager endpoint.
137
217
// Otherwise, a pre-defined Environment is looked up by name.
@@ -155,6 +235,16 @@ func ParseAzureEnvironment(cloudName, resourceManagerEndpoint, identitySystem st
155
235
return&env, err
156
236
}
157
237
238
+
// UsesNetworkResourceInDifferentTenant determines whether the AzureAuthConfig indicates to use network resources in different AAD Tenant and Subscription than those for the cluster
239
+
// Return true only when both NetworkResourceTenantID and NetworkResourceSubscriptionID are specified
240
+
// and they are not equals to TenantID and SubscriptionID
0 commit comments