How to use the @azure/ms-rest-nodeauth.interactiveLogin function in @azure/ms-rest-nodeauth

To help you get started, we’ve selected a few @azure/ms-rest-nodeauth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-js / sdk / eventhub / event-hubs / samples / sendReceiveWithInteractiveAuth.ts View on Github external
async function main(): Promise {
  // For now the interactive user needs to explicitly be assigned
  // the role of a constributor/owner even if the user is a subscription owner.
  // azure role assignment create -o contributor --scope /subscriptions//resourceGroups//providers/Microsoft.EventHub/namespaces/ --signInName 
  const credentials = await interactiveLogin({tokenAudience: aadEventHubsAudience});
  const client = EventHubClient.createFromAadTokenCredentials(address, path, credentials);
  const partitionIds = await client.getPartitionIds();
  await client.send({ body: "Hello awesome world!!" }, partitionIds[0]);
  const result: EventData[] =  await client.receiveBatch(partitionIds[0], 2, 5, { eventPosition: EventPosition.fromEnqueuedTime(Date.now()) });
  let i = 0;
  for (const data of result) {
    console.log("### Actual message (%d):", ++i, data.body);
  }
  await client.close();
}
github Azure / azure-sdk-for-js / sdk / eventhub / event-hubs / samples / interactiveLogin.ts View on Github external
async function main(): Promise {
  const credentials = await interactiveLogin({ tokenAudience: "https://eventhubs.azure.net/" });
  const client = EventHubClient.createFromAadTokenCredentials(evenHubsEndpoint, eventHubsName, credentials);
  /*
   Refer to other samples, and place your code here
   to send/receive events
  */
  await client.close();
}
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / samples / javascript / gettingStarted / interactiveLogin.js View on Github external
async function main() {
  const tokenCreds = await interactiveLogin({
    tokenAudience: "https://servicebus.azure.net/"
  });

  const sbClient = ServiceBusClient.createFromAadTokenCredentials(serviceBusEndpoint, tokenCreds);
  /*
   Refer to other samples, and place your code here
   to create queue clients, and send/receive messages
  */
  await sbClient.close();
}
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / samples / typescript / gettingStarted / interactiveLogin.ts View on Github external
async function main(): Promise {
  const tokenCreds = await interactiveLogin({
    tokenAudience: "https://servicebus.azure.net/"
  });

  const sbClient = ServiceBusClient.createFromAadTokenCredentials(serviceBusEndpoint, tokenCreds);
  /*
   Refer to other samples, and place your code here
   to create queue clients, and send/receive messages
  */
  await sbClient.close();
}