Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] Samples - Get account name, key, sas from environment if present #5321

Merged
merged 2 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdk/storage/storage-blob/samples/javascript/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class ConsoleHttpPipelineLogger {

async function main() {
// Fill in following settings before running this sample
const account = "";
const accountSas = "";
const localFilePath = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";
const localFilePath = "../README.md";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could upload the source code file itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which source code file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"./advanced.js"

Copy link
Member Author

@HarshaNalluru HarshaNalluru Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sample file names may change, readme will be present forever.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, I was thinking there could be folder changes. This is good to merge.


const pipeline = newPipeline(new AnonymousCredential(), {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/javascript/anonymousCred.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, AnonymousCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountSas = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";

// Use AnonymousCredential when url already includes a SAS signature
const anonymousCredential = new AnonymousCredential();
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob/samples/javascript/azureAdAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const { DefaultAzureCredential } = require("@azure/identity");

async function main() {
// Enter your storage account name
const account = "";
const account = process.env.ACCOUNT_NAME || "";

// ONLY AVAILABLE IN NODE.JS RUNTIME
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/javascript/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/javascript/customPipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class ConsoleHttpPipelineLogger {

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class RequestIDPolicy extends BaseRequestPolicy {

// Main function
async function main() {
const account = "";
const accountSas = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";

// Create a default pipeline with newPipeline
const pipeline = newPipeline(new AnonymousCredential());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down Expand Up @@ -106,7 +106,7 @@ async function main() {
console.log(`Blob ${i++}: ${blob.name}`);
}
// Gets next marker
console.log("\tContinuation")
console.log("\tContinuation");
let marker = response.value.nextMarker;
// Passing next marker as continuationToken
iterator = containerClient.listBlobsFlat().byPage({ continuationToken: marker, maxPageSize: 10 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/javascript/proxyAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/javascript/sharedKeyCred.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { BlobServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function main() {
// Create Blob Service Client from Account connection string or SAS connection string
// Account connection string example - `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
// SAS connection string example - `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
const STORAGE_CONNECTION_STRING = "";
const STORAGE_CONNECTION_STRING = process.env.STORAGE_CONNECTION_STRING || "";
// Note - Account connection string can only be used in node.
const blobServiceClient = BlobServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);

Expand Down
6 changes: 3 additions & 3 deletions sdk/storage/storage-blob/samples/typescript/advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class ConsoleHttpPipelineLogger {

async function main() {
// Fill in following settings before running this sample
const account = "";
const accountSas = "";
const localFilePath = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";
const localFilePath = "../README.md";

const pipeline = newPipeline(new AnonymousCredential(), {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/typescript/anonymousCred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, AnonymousCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountSas = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";

// Use AnonymousCredential when url already includes a SAS signature
const anonymousCredential = new AnonymousCredential();
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob/samples/typescript/azureAdAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { DefaultAzureCredential } from "@azure/identity";

async function main() {
// Enter your storage account name
const account = "";
const account = process.env.ACCOUNT_NAME || "";

// ONLY AVAILABLE IN NODE.JS RUNTIME
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/typescript/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, SharedKeyCredential, Models } from "../../src"; // C

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
11 changes: 8 additions & 3 deletions sdk/storage/storage-blob/samples/typescript/customPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
Setup: Enter your storage account name and shared key in main()
*/

import { BlobServiceClient, SharedKeyCredential, newPipeline, HttpPipelineLogLevel } from "../../src"; // Change to "@azure/storage-blob" in your package
import {
BlobServiceClient,
SharedKeyCredential,
newPipeline,
HttpPipelineLogLevel
} from "../../src"; // Change to "@azure/storage-blob" in your package

class ConsoleHttpPipelineLogger {
minimumLogLevel: any;
Expand Down Expand Up @@ -30,8 +35,8 @@ class ConsoleHttpPipelineLogger {

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class RequestIDPolicy extends BaseRequestPolicy {

// Main function
async function main() {
const account = "";
const accountSas = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";

// Create a default pipeline with newPipeline
const pipeline = newPipeline(new AnonymousCredential());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, SharedKeyCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, SharedKeyCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, SharedKeyCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/typescript/proxyAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, SharedKeyCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { BlobServiceClient, SharedKeyCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/samples/typescript/sharedKeyCred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BlobServiceClient, SharedKeyCredential } from "../../src"; // Change to

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function main() {
// Create Blob Service Client from Account connection string or SAS connection string
// Account connection string example - `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
// SAS connection string example - `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
const STORAGE_CONNECTION_STRING = "";
const STORAGE_CONNECTION_STRING = process.env.STORAGE_CONNECTION_STRING || "";
// Note - Account connection string can only be used in node.
const blobServiceClient = BlobServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);

Expand Down
6 changes: 3 additions & 3 deletions sdk/storage/storage-file/samples/javascript/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class ConsoleHttpPipelineLogger {

async function main() {
// Fill in following settings before running this sample
const account = "";
const accountSas = "";
const localFilePath = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";
const localFilePath = "../README.md";

const pipeline = newPipeline(new AnonymousCredential(), {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-file/samples/javascript/anonymousCred.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { FileServiceClient, AnonymousCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountSas = "";
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";

// Use AnonymousCredential when url already includes a SAS signature
const anonymousCredential = new AnonymousCredential();
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-file/samples/javascript/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { FileServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-file/samples/javascript/customPipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class ConsoleHttpPipelineLogger {

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { FileServiceClient, SharedKeyCredential } = require("../.."); // Change t

async function main() {
// Enter your storage account name and shared key
const account = "";
const accountKey = "";
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";

// Use SharedKeyCredential with storage account and account key
// SharedKeyCredential is only avaiable in Node.js runtime, not in browsers
Expand Down
Loading