How to use the @azure/storage-blob.ServiceURL.newPipeline function in @azure/storage-blob

To help you get started, we’ve selected a few @azure/storage-blob 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 / ng-deploy-azure / src / builders / actions / deploy.ts View on Github external
throw new Error('No path is configured for the files to deploy.');
  }

  const files = await getFiles(context, filesPath, projectRoot);
  if (files.length === 0) {
    throw new Error('Target did not produce any files, or the path is incorrect.');
  }

  const client = new StorageManagementClient(credentials, azureHostingConfig.azureHosting.subscription);
  const accountKey = await getAccountKey(
    azureHostingConfig.azureHosting.account,
    client,
    azureHostingConfig.azureHosting.resourceGroupName
  );

  const pipeline = ServiceURL.newPipeline(new SharedKeyCredential(azureHostingConfig.azureHosting.account, accountKey));

  const serviceURL = new ServiceURL(
    `https://${azureHostingConfig.azureHosting.account}.blob.core.windows.net`,
    pipeline
  );

  await uploadFilesToAzure(serviceURL, context, filesPath, files);

  const accountProps = await client.storageAccounts.getProperties(
    azureHostingConfig.azureHosting.resourceGroupName,
    azureHostingConfig.azureHosting.account
  );
  const endpoint = accountProps.primaryEndpoints && accountProps.primaryEndpoints.web;

  context.logger.info(chalk.green(`see your deployed site at ${endpoint}`));
  // TODO: log url for account at Azure portal
github Azure / ng-deploy-azure / src / util / azure / account.ts View on Github external
location,
    sku: { name: 'Standard_LRS' }
  });
  await poller.pollUntilFinished();

  spinner.start('Retrieving account keys');
  const accountKey = await getAccountKey(account, client, resourceGroupName);
  if (!accountKey) {
    throw new SchematicsException('no keys retrieved for storage account');
  }
  spinner.succeed();

  spinner.start('Creating web container');
  await createWebContainer(client, resourceGroupName, account);
  spinner.succeed();
  const pipeline = ServiceURL.newPipeline(new SharedKeyCredential(account, accountKey));
  const serviceURL = new ServiceURL(`https://${account}.blob.core.windows.net`, pipeline);
  spinner.start('Setting container to be publicly available static site');
  await setStaticSiteToPublic(serviceURL);
  spinner.succeed();
}