Skip to content

Commit

Permalink
Simplify example blob_05_default_credential.rs (#1373)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits authored Sep 13, 2023
1 parent 3332597 commit cb7c8e5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions sdk/storage_blobs/examples/blob_05_default_credential.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#[macro_use]
extern crate log;

use std::sync::Arc;

use azure_core::{
auth::TokenCredential,
error::{ErrorKind, ResultExt},
};
use azure_identity::DefaultAzureCredential;
use azure_storage::prelude::*;
use azure_storage_blobs::prelude::*;

#[tokio::main]
Expand All @@ -24,11 +25,7 @@ async fn main() -> azure_core::Result<()> {
.nth(3)
.expect("please specify the blob name as third command line parameter");

let bearer_token = DefaultAzureCredential::default()
.get_token("https://storage.azure.com/")
.await?;

let storage_credentials = StorageCredentials::BearerToken(bearer_token.token.secret().into());
let storage_credentials: Arc<dyn TokenCredential> = Arc::new(DefaultAzureCredential::default());
let blob_client = BlobServiceClient::new(account, storage_credentials)
.container_client(&container)
.blob_client(&blob);
Expand Down

0 comments on commit cb7c8e5

Please sign in to comment.