@@ -3,7 +3,7 @@ import * as tl from 'azure-pipelines-task-lib/task';
3
3
#if WIF
4
4
import { configureEntraCredProvider } from "azure-pipelines-tasks-artifacts-common/credentialProviderUtils" ;
5
5
#endif
6
- import { installCredProviderToUserProfile , configureCredProvider } from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
6
+ import { installCredProviderToUserProfile , configureCredProvider , configureCredProviderForSameOrganizationFeeds } from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
7
7
import { ProtocolType } from 'azure-pipelines-tasks-artifacts-common/protocols' ;
8
8
import { getPackagingServiceConnections } from 'azure-pipelines-tasks-artifacts-common/serviceConnectionUtils'
9
9
import { emitTelemetry } from 'azure-pipelines-tasks-artifacts-common/telemetry'
@@ -23,14 +23,21 @@ async function main(): Promise<void> {
23
23
const feedUrl = tl . getInput ( "feedUrl" ) ;
24
24
const entraWifServiceConnectionName = tl . getInput ( "workloadIdentityServiceConnection" ) ;
25
25
26
+ // Only cross-org feedUrls are supported with Azure Devops service connections. If feedUrl is internal, the task will fail.
26
27
if ( feedUrl && entraWifServiceConnectionName ) {
27
28
tl . debug ( tl . loc ( "Info_AddingFederatedFeedAuth" , entraWifServiceConnectionName , feedUrl ) ) ;
28
- await configureEntraCredProvider ( ProtocolType . NuGet , feedUrl , entraWifServiceConnectionName ) ;
29
+ await configureEntraCredProvider ( ProtocolType . NuGet , entraWifServiceConnectionName , feedUrl ) ;
30
+ federatedFeedAuthSuccessCount ++ ;
29
31
console . log ( tl . loc ( "Info_SuccessAddingFederatedFeedAuth" , feedUrl ) ) ;
30
- federatedFeedAuthSuccessCount ++ ;
31
32
32
33
return ;
33
- } else if ( feedUrl || entraWifServiceConnectionName ) {
34
+ }
35
+ // If the user doesn't provide a feedUrl, use the Azure Devops service connection to replace the Build Service
36
+ else if ( ! feedUrl && entraWifServiceConnectionName ) {
37
+ configureCredProviderForSameOrganizationFeeds ( ProtocolType . NuGet , entraWifServiceConnectionName ) ;
38
+ return ;
39
+ }
40
+ else if ( feedUrl ) {
34
41
throw new Error ( tl . loc ( "Error_MissingFeedUrlOrServiceConnection" ) ) ;
35
42
}
36
43
#endif
0 commit comments