Changed keyword to ActiveDirectoryServicePrincipal (#1229)

This commit is contained in:
Jenny Tam 2021-01-15 10:02:35 -08:00 committed by GitHub
parent 7b961b0028
commit 6d2b93881f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 10 deletions

View file

@ -313,6 +313,7 @@ jobs:
php --ri sqlsrv php --ri sqlsrv
php --ri pdo_sqlsrv php --ri pdo_sqlsrv
displayName: 'Load drivers' displayName: 'Load drivers'
condition: false
- script: | - script: |
docker pull microsoft/mssql-server-windows-developer docker pull microsoft/mssql-server-windows-developer

View file

@ -379,7 +379,7 @@ pdo_error PDO_ERRORS[] = {
}, },
{ {
PDO_SQLSRV_ERROR_INVALID_AUTHENTICATION_OPTION, PDO_SQLSRV_ERROR_INVALID_AUTHENTICATION_OPTION,
{ IMSSP, (SQLCHAR*) "Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectorySPA is supported.", -73, false } { IMSSP, (SQLCHAR*) "Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectoryServicePrincipal is supported.", -73, false }
}, },
{ {
SQLSRV_ERROR_CE_DRIVER_REQUIRED, SQLSRV_ERROR_CE_DRIVER_REQUIRED,

View file

@ -719,7 +719,7 @@ namespace AzureADOptions {
MAX_AAD_AUTH_TYPE MAX_AAD_AUTH_TYPE
}; };
const char *AADAuths[] = { "SqlPassword", "ActiveDirectoryPassword", "ActiveDirectoryMsi", "ActiveDirectorySPA" }; const char *AADAuths[] = { "SqlPassword", "ActiveDirectoryPassword", "ActiveDirectoryMsi", "ActiveDirectoryServicePrincipal" };
bool isAuthValid(_In_z_ const char* value, _In_ size_t value_len) bool isAuthValid(_In_z_ const char* value, _In_ size_t value_len)
{ {

View file

@ -365,7 +365,7 @@ ss_error SS_ERRORS[] = {
}, },
{ {
SS_SQLSRV_ERROR_INVALID_AUTHENTICATION_OPTION, SS_SQLSRV_ERROR_INVALID_AUTHENTICATION_OPTION,
{ IMSSP, (SQLCHAR*)"Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectorySPA is supported.", -62, false } { IMSSP, (SQLCHAR*)"Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectoryServicePrincipal is supported.", -62, false }
}, },
{ {
SS_SQLSRV_ERROR_AE_QUERY_SQLTYPE_REQUIRED, SS_SQLSRV_ERROR_AE_QUERY_SQLTYPE_REQUIRED,

View file

@ -96,5 +96,5 @@ if ($azureServer != 'TARGET_AD_SERVER') {
Connected successfully with Authentication=SqlPassword. Connected successfully with Authentication=SqlPassword.
string(1) "%d" string(1) "%d"
Could not connect with Authentication=ActiveDirectoryIntegrated. Could not connect with Authentication=ActiveDirectoryIntegrated.
SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectorySPA is supported. SQLSTATE[IMSSP]: Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectoryServicePrincipal is supported.
%s with Authentication=ActiveDirectoryPassword. %s with Authentication=ActiveDirectoryPassword.

View file

@ -62,7 +62,7 @@ function connectAzureDB($showException)
$conn = false; $conn = false;
try { try {
$connectionInfo = "Database = $adDatabase; Authentication = ActiveDirectorySPA;"; $connectionInfo = "Database = $adDatabase; Authentication = ActiveDirectoryServicePrincipal;";
$conn = new PDO("sqlsrv:server = $adServer; $connectionInfo", $adSPClientId, $adSPClientSecret); $conn = new PDO("sqlsrv:server = $adServer; $connectionInfo", $adSPClientId, $adSPClientSecret);
} catch (PDOException $e) { } catch (PDOException $e) {
if ($showException) { if ($showException) {
@ -78,7 +78,7 @@ function connectAzureDB($showException)
// First test connecting to regular sql server // First test connecting to regular sql server
require_once('MsSetup.inc'); require_once('MsSetup.inc');
try { try {
$conn = new PDO("sqlsrv:server = $server; Authentication = ActiveDirectorySPA;", $uid, $pwd); $conn = new PDO("sqlsrv:server = $server; Authentication = ActiveDirectoryServicePrincipal;", $uid, $pwd);
echo "Expect regular connection to fail\n"; echo "Expect regular connection to fail\n";
} catch(PDOException $e) { } catch(PDOException $e) {
// do nothing // do nothing

View file

@ -106,7 +106,7 @@ Array
[SQLSTATE] => IMSSP [SQLSTATE] => IMSSP
[1] => -62 [1] => -62
[code] => -62 [code] => -62
[2] => Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectorySPA is supported. [2] => Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectoryServicePrincipal is supported.
[message] => Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectorySPA is supported. [message] => Invalid option for the Authentication keyword. Only SqlPassword, ActiveDirectoryPassword, ActiveDirectoryMsi or ActiveDirectoryServicePrincipal is supported.
) )
%s with Authentication=ActiveDirectoryPassword. %s with Authentication=ActiveDirectoryPassword.

View file

@ -70,7 +70,7 @@ function connectAzureDB($showException)
$conn = false; $conn = false;
$connectionInfo = array("Database"=>$adDatabase, $connectionInfo = array("Database"=>$adDatabase,
"Authentication"=>"ActiveDirectorySPA", "Authentication"=>"ActiveDirectoryServicePrincipal",
"UID"=>$adSPClientId, "UID"=>$adSPClientId,
"PWD"=>$adSPClientSecret); "PWD"=>$adSPClientSecret);
@ -89,7 +89,7 @@ function connectAzureDB($showException)
} }
// Try connecting to an invalid server. Expect this to fail. // Try connecting to an invalid server. Expect this to fail.
$connectionInfo = array("Authentication"=>"ActiveDirectorySPA"); $connectionInfo = array("Authentication"=>"ActiveDirectoryServicePrincipal");
$conn = sqlsrv_connect('invalidServer', $connectionInfo); $conn = sqlsrv_connect('invalidServer', $connectionInfo);
if ($conn) { if ($conn) {
fatalError("AzureAD Service Principal test: expected to fail with invalidServer\n"); fatalError("AzureAD Service Principal test: expected to fail with invalidServer\n");