Reputation: 5989
I'm running pulumi inside an azure devops pipeline. I need to find the the pipeline Service Principal ObjectId
var clientConfig = Output.Create(Pulumi.Azure.Core.Invokes.GetClientConfig());
var clientId = clientConfig.Apply(c => c.ObjectId);
This gives me the application ObjectId as an Output, now from here how can I find my Service Principal ObjectId.
I can't do that because clientId is Output<string>
and ObjectId is expecting string
var adApp = Output.Create(Pulumi.AzureAD.Invokes.GetApplication(new GetApplicationArgs { ObjectId = clientId}));
var adSp = Output.Create(Pulumi.AzureAD.Invokes.GetServicePrincipal(new GetServicePrincipalArgs { ApplicationId = adApp.App(a => a.ApplicationId)});
Upvotes: 0
Views: 519
Reputation: 35124
You should use Apply
method here:
var adApp = clientId.Apply(id =>
Pulumi.AzureAD.Invokes.GetApplication(
new GetApplicationArgs { ObjectId = id }));
var adSp = adApp.ApplicationId.Apply(appid =>
Pulumi.AzureAD.Invokes.GetServicePrincipal(
new GetServicePrincipalArgs { ApplicationId = appid }));
Upvotes: 1