In azure-native, when I have a system assigned ide...
# general
t
In azure-native, when I have a system assigned identity, how can i retrieve it properly? having this code:
Copy code
const appService = new azureNative.web.WebApp(
      name,
      {
        ...
        identity: {
          type: azureNative.web.ManagedServiceIdentityType.SystemAssigned,
        },
      }, {},
    );
I can do this:
Copy code
const principalId = appService.identity.apply((identity) => identity!.principalId);
However, the types states the identity can be
undefined
. Is this a type issue or can the identity by still not provisioned at the time I try to retrieve it?
v
try changing it to
const principalId = appService.identity.principalId.apply((principalId) => principalId);
but if you're planning on using that output with another pulumi resource as an input, you should just be able to pass it in to the resource arguments. inputs/outputs are exchangeable
t
the
appService.identity
is of type
pulumi.Output<azureNative.types.output.web.ManagedServiceIdentityResponse | undefined>
, in short
pulumi.Output<Identity | undefined>
, you cannot do
.principalId
v
you should just be able to use the output directly. i'm afraid ive never used the azure native provider