Skip to content

Commit 2798e6a

Browse files
committed
ic: azure: validate credentials mode for managed identities
CredentialsMode must be set to 'Manual' when using Managed Identities authentication. This change adds a validation check and errors out if that's not the case with: ``` INFO Credentials loaded from file "/home/azureuser/.azure/osServicePrincipal.json" WARNING Using Managed Identity to authenticate. Please be warned cluster does not support MSI and only the installer does. FATAL failed to fetch Bootstrap Ignition Config: failed to fetch dependency of "Bootstrap Ignition Config": failed to fetch dependency of "CVO Ignore": failed to fetch dependency of "Common Manifests": failed to fetch dependency of "DNS Config": failed to generate asset "Platform Credentials Check": authentication with client certificates or managed identity is only supported in manual credentials mode ```
1 parent 248f6c3 commit 2798e6a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/asset/installconfig/platformcredscheck.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/pkg/errors"
88

99
"github.com/openshift/installer/pkg/asset"
10+
azureconfig "github.com/openshift/installer/pkg/asset/installconfig/azure"
1011
gcpconfig "github.com/openshift/installer/pkg/asset/installconfig/gcp"
1112
ibmcloudconfig "github.com/openshift/installer/pkg/asset/installconfig/ibmcloud"
1213
openstackconfig "github.com/openshift/installer/pkg/asset/installconfig/openstack"
@@ -94,8 +95,11 @@ func (a *PlatformCredsCheck) Generate(dependencies asset.Parents) error {
9495
if err != nil {
9596
return errors.Wrap(err, "creating Azure session")
9697
}
97-
if azureSession.Credentials.ClientCertificatePath != "" && ic.Config.CredentialsMode != types.ManualCredentialsMode {
98-
return fmt.Errorf("authentication with client certificates is only supported in manual credentials mode")
98+
switch azureSession.AuthType {
99+
case azureconfig.ClientCertificateAuth, azureconfig.ManagedIdentityAuth:
100+
if ic.Config.CredentialsMode != types.ManualCredentialsMode {
101+
return fmt.Errorf("authentication with client certificates or managed identity is only supported in manual credentials mode")
102+
}
99103
}
100104
case ovirt.Name:
101105
con, err := ovirtconfig.NewConnection()

0 commit comments

Comments
 (0)