Skip to content

Commit

Permalink
Changed keyword to ActiveDirectoryServicePrincipal (#1229)
Browse files Browse the repository at this point in the history
  • Loading branch information
yitam authored Jan 15, 2021
1 parent 7b961b0 commit 6d2b938
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ jobs:
php --ri sqlsrv
php --ri pdo_sqlsrv
displayName: 'Load drivers'
condition: false
- script: |
docker pull microsoft/mssql-server-windows-developer
Expand Down
2 changes: 1 addition & 1 deletion source/pdo_sqlsrv/pdo_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ pdo_error PDO_ERRORS[] = {
},
{
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,
Expand Down
2 changes: 1 addition & 1 deletion source/shared/core_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ namespace AzureADOptions {
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)
{
Expand Down
2 changes: 1 addition & 1 deletion source/sqlsrv/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ ss_error SS_ERRORS[] = {
},
{
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ if ($azureServer != 'TARGET_AD_SERVER') {
Connected successfully with Authentication=SqlPassword.
string(1) "%d"
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.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function connectAzureDB($showException)

$conn = false;
try {
$connectionInfo = "Database = $adDatabase; Authentication = ActiveDirectorySPA;";
$connectionInfo = "Database = $adDatabase; Authentication = ActiveDirectoryServicePrincipal;";
$conn = new PDO("sqlsrv:server = $adServer; $connectionInfo", $adSPClientId, $adSPClientSecret);
} catch (PDOException $e) {
if ($showException) {
Expand All @@ -78,7 +78,7 @@ function connectAzureDB($showException)
// First test connecting to regular sql server
require_once('MsSetup.inc');
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";
} catch(PDOException $e) {
// do nothing
Expand Down
4 changes: 2 additions & 2 deletions test/functional/sqlsrv/sqlsrv_azure_ad_authentication.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Array
[SQLSTATE] => IMSSP
[1] => -62
[code] => -62
[2] => 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 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 ActiveDirectoryServicePrincipal is supported.
)
%s with Authentication=ActiveDirectoryPassword.
4 changes: 2 additions & 2 deletions test/functional/sqlsrv/sqlsrv_azure_ad_service_principal.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function connectAzureDB($showException)

$conn = false;
$connectionInfo = array("Database"=>$adDatabase,
"Authentication"=>"ActiveDirectorySPA",
"Authentication"=>"ActiveDirectoryServicePrincipal",
"UID"=>$adSPClientId,
"PWD"=>$adSPClientSecret);

Expand All @@ -89,7 +89,7 @@ function connectAzureDB($showException)
}

// Try connecting to an invalid server. Expect this to fail.
$connectionInfo = array("Authentication"=>"ActiveDirectorySPA");
$connectionInfo = array("Authentication"=>"ActiveDirectoryServicePrincipal");
$conn = sqlsrv_connect('invalidServer', $connectionInfo);
if ($conn) {
fatalError("AzureAD Service Principal test: expected to fail with invalidServer\n");
Expand Down

0 comments on commit 6d2b938

Please sign in to comment.