├── eng ├── scripts │ ├── Use-Rust.ps1 │ ├── Yank-Crates.ps1 │ └── Get-PackageDependencies.ps1 ├── common │ ├── testproxy │ │ ├── target_version.txt │ │ ├── dotnet-devcert.pfx │ │ ├── test-proxy-tool-shutdown.yml │ │ ├── localhost.conf │ │ ├── apply-dev-cert.sh │ │ ├── scripts │ │ │ └── override-proxy-version.ps1 │ │ ├── publish-proxy-logs.yml │ │ ├── install-test-proxy.ps1 │ │ └── dotnet-devcert.crt │ ├── tsp-client │ │ └── package.json │ ├── spelling │ │ └── package.json │ ├── scripts │ │ ├── Import-AzModules.ps1 │ │ ├── job-matrix │ │ │ └── README.md │ │ ├── trust-proxy-certificate.ps1 │ │ ├── check-for-git-changes.ps1 │ │ ├── Update-GeneratedSdks.ps1 │ │ ├── get-markdown-files-from-changed-files.ps1 │ │ ├── Add-IssueLabels.ps1 │ │ ├── Add-IssueComment.ps1 │ │ ├── Get-PullRequestCreator.ps1 │ │ ├── Verify-AgentOS.ps1 │ │ ├── Delete-RemoteTag.ps1 │ │ ├── Remove-IssueLabel.ps1 │ │ ├── Verify-ChangeLog.ps1 │ │ ├── Get-BuildSourceDescription.ps1 │ │ ├── Write-FileSystemMetrics.ps1 │ │ ├── Update-PullRequest-In-ReleasePlan.ps1 │ │ ├── Set-VcpkgWriteModeCache.ps1 │ │ └── X509Certificate2 │ │ │ └── README.md │ ├── pipelines │ │ └── templates │ │ │ ├── steps │ │ │ ├── write-filesystemmetrics.yml │ │ │ ├── enable-long-path-support.yml │ │ │ ├── bypass-local-dns.yml │ │ │ ├── docsms-ensure-validation.yml │ │ │ ├── verify-agent-os.yml │ │ │ ├── set-daily-docs-branch-name.yml │ │ │ ├── devops-variables-clear.yml │ │ │ ├── verify-changelogs.yml │ │ │ ├── retain-run.yml │ │ │ ├── devops-variables-set.yml │ │ │ ├── install-pipeline-generation.yml │ │ │ ├── cosmos-emulator.yml │ │ │ ├── validate-filename.yml │ │ │ ├── mark-release-completion.yml │ │ │ ├── cache-ps-modules.yml │ │ │ ├── set-default-branch.yml │ │ │ ├── verify-restapi-spec-location.yml │ │ │ ├── create-tags-and-git-release.yml │ │ │ ├── verify-changelog.yml │ │ │ ├── create-authenticated-npmrc.yml │ │ │ ├── verify-readme.yml │ │ │ ├── verify-samples.yml │ │ │ ├── publish-blobs.yml │ │ │ ├── set-test-pipeline-version.yml │ │ │ ├── set-vcpkg-cache-vars.yml │ │ │ ├── daily-dev-build-variable.yml │ │ │ ├── publish-artifact.yml │ │ │ └── detect-api-changes.yml │ │ │ └── stages │ │ │ └── archetype-sdk-tool-pwsh.yml │ ├── README.md │ ├── TestResources │ │ ├── clouds │ │ │ ├── AzureCloud.json │ │ │ ├── AzureChinaCloud.json │ │ │ └── AzureUSGovernment.json │ │ ├── New-TestResources.cmd │ │ ├── Remove-TestResources.cmd │ │ └── Update-TestResources.cmd │ ├── docgeneration │ │ └── templates │ │ │ └── matthews │ │ │ └── partials │ │ │ ├── namespace.tmpl.partial │ │ │ ├── affix.tmpl.partial │ │ │ └── enum.tmpl.partial │ └── instructions │ │ ├── copilot │ │ └── sdk-release.instructions.md │ │ └── azsdk-tools │ │ ├── typespec-docs.instructions.md │ │ └── check-package-validation.instructions.md ├── vcpkg.json ├── tools │ └── generate_api_report │ │ ├── rust-toolchain.toml │ │ ├── Cargo.toml │ │ └── build.rs ├── pipelines │ ├── templates │ │ ├── variables │ │ │ ├── rust.yml │ │ │ ├── globals.yml │ │ │ └── image.yml │ │ ├── stages │ │ │ └── platform-matrix.json │ │ └── steps │ │ │ └── vcpkg.yml │ ├── pullrequest.yml │ └── pr.yml ├── dict │ ├── rust-custom.txt │ └── crates.txt ├── CredScanSuppression.json ├── cgmanifest.json └── emitter-package.json ├── FAQ.md ├── sdk ├── cosmos │ ├── azure_data_cosmos_native │ │ ├── .gitignore │ │ ├── include │ │ │ └── .gitignore │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── macros.rs │ │ ├── Cargo.toml │ │ ├── c_tests │ │ │ └── version.c │ │ └── CMakeLists.txt │ ├── azure_data_cosmos │ │ ├── test-features.txt │ │ ├── src │ │ │ ├── routing │ │ │ │ └── mod.rs │ │ │ ├── handler │ │ │ │ └── mod.rs │ │ │ ├── utils.rs │ │ │ ├── clients │ │ │ │ └── mod.rs │ │ │ ├── serde.rs │ │ │ └── lib.rs │ │ ├── docs │ │ │ └── control-plane-warning.md │ │ ├── examples │ │ │ └── cosmos │ │ │ │ └── metadata.rs │ │ └── tests │ │ │ └── framework │ │ │ └── mod.rs │ ├── assets.json │ ├── .dict.txt │ └── ci.yml ├── storage │ ├── CHANGELOG.md │ ├── azure_storage_blob │ │ ├── src │ │ │ ├── streams │ │ │ │ └── mod.rs │ │ │ ├── pipeline │ │ │ │ ├── mod.rs │ │ │ │ └── storage_headers_policy.rs │ │ │ ├── generated │ │ │ │ ├── models │ │ │ │ │ └── mod.rs │ │ │ │ ├── clients │ │ │ │ │ └── mod.rs │ │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ └── clients │ │ │ │ └── mod.rs │ │ ├── tsp-location.yaml │ │ ├── assets.json │ │ ├── perf │ │ │ └── perf_tests.rs │ │ ├── perf-tests.yml │ │ └── Cargo.toml │ ├── azure_storage_common │ │ ├── src │ │ │ └── lib.rs │ │ ├── README.md │ │ └── Cargo.toml │ ├── azure_storage_queue │ │ ├── tsp-location.yaml │ │ ├── assets.json │ │ ├── examples │ │ │ └── README.md │ │ ├── src │ │ │ ├── clients │ │ │ │ └── mod.rs │ │ │ ├── generated │ │ │ │ ├── clients │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ └── models │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── enums.rs │ │ │ └── lib.rs │ │ ├── CHANGELOG.md │ │ └── Cargo.toml │ ├── .dict.txt │ ├── azure_storage_blob_test │ │ └── Cargo.toml │ └── ci.yml ├── canary │ ├── azure_canary_core │ │ ├── README.md │ │ ├── CHANGELOG.md │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── README.md │ ├── azure_canary │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── ci.yml ├── core │ ├── azure_core_amqp │ │ ├── .dict.txt │ │ ├── src │ │ │ └── fe2o3 │ │ │ │ ├── messaging │ │ │ │ └── message_target.rs │ │ │ │ └── mod.rs │ │ └── Test-Cleanup.ps1 │ ├── azure_core_macros │ │ ├── README.md │ │ ├── CHANGELOG.md │ │ └── Cargo.toml │ ├── azure_core_test │ │ ├── .tsp-location.yaml │ │ ├── src │ │ │ ├── root_readme.rs │ │ │ ├── docs │ │ │ │ ├── root_readme.rs │ │ │ │ └── mod.rs │ │ │ ├── http │ │ │ │ └── mod.rs │ │ │ └── recording │ │ │ │ └── policy.rs │ │ └── build.rs │ ├── typespec_client_core │ │ ├── examples │ │ │ └── common │ │ │ │ └── mod.rs │ │ └── src │ │ │ ├── http │ │ │ ├── models │ │ │ │ └── mod.rs │ │ │ ├── headers │ │ │ │ └── mod.rs │ │ │ ├── request │ │ │ │ └── options │ │ │ │ │ └── mod.rs │ │ │ ├── clients │ │ │ │ └── noop.rs │ │ │ └── policies │ │ │ │ └── retry │ │ │ │ └── none.rs │ │ │ ├── error │ │ │ └── mod.rs │ │ │ ├── sleep.rs │ │ │ ├── lib.rs │ │ │ └── async_runtime │ │ │ ├── tokio_runtime.rs │ │ │ └── web_runtime.rs │ ├── azure_core │ │ ├── src │ │ │ ├── http │ │ │ │ ├── models │ │ │ │ │ └── mod.rs │ │ │ │ ├── request │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── options │ │ │ │ │ │ └── mod.rs │ │ │ │ ├── policies │ │ │ │ │ ├── auth │ │ │ │ │ │ └── mod.rs │ │ │ │ │ └── mod.rs │ │ │ │ ├── options │ │ │ │ │ ├── instrumentation.rs │ │ │ │ │ └── user_agent.rs │ │ │ │ └── mod.rs │ │ │ ├── error │ │ │ │ └── mod.rs │ │ │ └── macros.rs │ │ ├── build.rs │ │ ├── perf-tests.yml │ │ ├── perf │ │ │ └── perf.rs │ │ └── perf.yml │ ├── azure_core_opentelemetry │ │ ├── assets.json │ │ ├── examples │ │ │ └── basic_usage.rs │ │ ├── src │ │ │ └── lib.rs │ │ ├── CHANGELOG.md │ │ └── Cargo.toml │ ├── typespec │ │ ├── README.md │ │ ├── src │ │ │ ├── lib.rs │ │ │ ├── http │ │ │ │ └── mod.rs │ │ │ └── json.rs │ │ └── Cargo.toml │ ├── perf-tests.yml │ ├── typespec_macros │ │ ├── tests │ │ │ └── data │ │ │ │ └── safe-debug-tests │ │ │ │ ├── Cargo.toml │ │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── Cargo.toml │ ├── azure_core_test_macros │ │ ├── Cargo.toml │ │ └── README.md │ └── perf.yml ├── eventhubs │ ├── .dict.txt │ ├── assets.json │ ├── azure_messaging_eventhubs │ │ ├── assets.json │ │ ├── src │ │ │ └── common │ │ │ │ ├── recoverable │ │ │ │ └── mod.rs │ │ │ │ └── user_agent.rs │ │ ├── build.rs │ │ ├── perf-tests.yml │ │ ├── tests │ │ │ └── common │ │ │ │ └── mod.rs │ │ ├── examples │ │ │ └── eventhubs_properties.rs │ │ └── perf.yml │ ├── azure_messaging_eventhubs_checkpointstore_blob │ │ ├── src │ │ │ └── lib.rs │ │ └── CHANGELOG.md │ ├── test-resources-post.ps1 │ └── ci.yml ├── identity │ ├── azure_identity │ │ ├── tests │ │ │ ├── certificate.pfx │ │ │ ├── default_options_test.rs │ │ │ └── tools │ │ │ │ └── deployed_live_test │ │ │ │ └── Cargo.toml │ │ ├── managed-identity-matrix.json │ │ ├── src │ │ │ └── process │ │ │ │ ├── tokio.rs │ │ │ │ └── standard.rs │ │ └── examples │ │ │ └── azure_cli_credentials.rs │ ├── .dict.txt │ ├── test-resources-pre.ps1 │ └── ci.yml ├── keyvault │ ├── assets.json │ ├── azure_security_keyvault_keys │ │ ├── tsp-location.yaml │ │ ├── perf-tests.yml │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── generated │ │ │ │ ├── clients │ │ │ │ └── mod.rs │ │ │ │ ├── models │ │ │ │ └── mod.rs │ │ │ │ └── mod.rs │ │ ├── perf │ │ │ └── perf_tests.rs │ │ ├── perf-resources.bicep │ │ └── perf.yml │ ├── azure_security_keyvault_secrets │ │ ├── tsp-location.yaml │ │ ├── perf-tests.yml │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── generated │ │ │ │ ├── clients │ │ │ │ └── mod.rs │ │ │ │ ├── models │ │ │ │ └── mod.rs │ │ │ │ └── mod.rs │ │ └── perf-resources.bicep │ ├── azure_security_keyvault_certificates │ │ ├── tsp-location.yaml │ │ └── src │ │ │ ├── generated │ │ │ ├── clients │ │ │ │ └── mod.rs │ │ │ ├── models │ │ │ │ └── mod.rs │ │ │ └── mod.rs │ │ │ └── lib.rs │ ├── .dict.txt │ ├── azure_security_keyvault_test │ │ └── Cargo.toml │ └── test-resources.bicep └── servicebus │ ├── .dict.txt │ ├── azure_messaging_servicebus │ ├── src │ │ └── common │ │ │ └── mod.rs │ ├── CHANGELOG.md │ ├── test-resources-pre.ps1 │ └── examples │ │ └── from_trait_usage.rs │ └── ci.yml ├── .rustfmt.toml ├── .clippy.toml ├── .github ├── CODEOWNERS_baseline_errors.txt ├── event-processor.config ├── instructions │ └── changelog.instructions.md └── workflows │ ├── post-apiview.yml │ └── event.yml ├── rust-toolchain.toml ├── .vscode ├── extensions.json ├── tasks.json └── settings.json ├── .devcontainer ├── Dockerfile ├── oncreate └── devcontainer.json ├── .taplo.toml ├── .gitattributes ├── CODE_OF_CONDUCT.md ├── .editorconfig ├── doc ├── dev │ └── README.md ├── git-commit-instructions.md └── github-pullrequest-instructions.md ├── .gitignore ├── .config ├── 1espt │ └── PipelineAutobaseliningConfig.yml └── guardian │ └── .gdnbaselines ├── deny.toml └── LICENSE.txt /eng/scripts/Use-Rust.ps1: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # Frequently Asked Questions 2 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | -------------------------------------------------------------------------------- /.rustfmt.toml: -------------------------------------------------------------------------------- 1 | newline_style = "Unix" 2 | edition = "2021" 3 | -------------------------------------------------------------------------------- /eng/common/testproxy/target_version.txt: -------------------------------------------------------------------------------- 1 | 1.0.0-dev.20251209.1 2 | -------------------------------------------------------------------------------- /.clippy.toml: -------------------------------------------------------------------------------- 1 | allow-unwrap-in-tests = true 2 | allow-expect-in-tests = true -------------------------------------------------------------------------------- /sdk/storage/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.0 (2024-07) 2 | 3 | - initial TODO 4 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/test-features.txt: -------------------------------------------------------------------------------- 1 | key_auth 2 | preview_query_engine -------------------------------------------------------------------------------- /.github/CODEOWNERS_baseline_errors.txt: -------------------------------------------------------------------------------- 1 | Path entry, /Cargo.lock, is missing owners 2 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/streams/mod.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod partitioned_stream; 2 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary_core/README.md: -------------------------------------------------------------------------------- 1 | # Template crate for Azure SDK pipeline testing 2 | -------------------------------------------------------------------------------- /sdk/canary/README.md: -------------------------------------------------------------------------------- 1 | # Canary 2 | 3 | Canary crates for testing build and release pipelines 4 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.0 (unreleased) 2 | 3 | - Renamed from "Template" to "Canary" 4 | -------------------------------------------------------------------------------- /sdk/core/azure_core_amqp/.dict.txt: -------------------------------------------------------------------------------- 1 | mgmt 2 | sasl 3 | amqps 4 | sastoken 5 | smallulong 6 | smalluint 7 | -------------------------------------------------------------------------------- /eng/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azure-sdk-for-rust", 3 | "dependencies": [ 4 | "openssl" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary_core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.0 (unreleased) 2 | 3 | - Renamed from "Template" to "Canary" 4 | -------------------------------------------------------------------------------- /sdk/eventhubs/.dict.txt: -------------------------------------------------------------------------------- 1 | amqps 2 | consts 3 | eventdata 4 | mgmt 5 | rustc 6 | myapp 7 | yourcontainername 8 | -------------------------------------------------------------------------------- /sdk/core/azure_core_macros/README.md: -------------------------------------------------------------------------------- 1 | # Azure client library macros 2 | 3 | Macros for client libraries built on `azure_core`. 4 | -------------------------------------------------------------------------------- /eng/common/testproxy/dotnet-devcert.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-sdk-for-rust/HEAD/eng/common/testproxy/dotnet-devcert.pfx -------------------------------------------------------------------------------- /eng/common/tsp-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@azure-tools/typespec-client-generator-cli": "0.31.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_common/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | -------------------------------------------------------------------------------- /sdk/identity/azure_identity/tests/certificate.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-sdk-for-rust/HEAD/sdk/identity/azure_identity/tests/certificate.pfx -------------------------------------------------------------------------------- /eng/common/spelling/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cspell-version-pin", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "cspell": "^9.4.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /sdk/core/azure_core_amqp/src/fe2o3/messaging/message_target.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/include/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything except this ignore file, this directory contains build artifacts 2 | * 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test/.tsp-location.yaml: -------------------------------------------------------------------------------- 1 | repo: Azure/azure-sdk-tools 2 | commit: 7b69c611727bd9f6e33377dd51ecf00407ccc4ec 3 | directory: tools/test-proxy/typespec 4 | -------------------------------------------------------------------------------- /eng/tools/generate_api_report/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly-2025-01-12" 3 | components = [ 4 | "cargo", 5 | "rust-docs", 6 | "rust-std", 7 | ] 8 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | components = [ 3 | "rustc", 4 | "rustfmt", 5 | "rust-std", 6 | "cargo", 7 | "clippy", 8 | "rust-analyzer", 9 | ] 10 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test/src/root_readme.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../../../../README.md")] 2 | 3 | // Make sure the repository's root README.md has no syntactical errors. 4 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/examples/common/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | pub mod fs; 5 | -------------------------------------------------------------------------------- /eng/pipelines/templates/variables/rust.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | RUSTFLAGS: "-Dwarnings" 3 | RUSTDOCFLAGS: "-Dwarnings" 4 | RUST_LOG: $[iif(eq(variables['System.Debug'], 'true'), 'debug', '')] 5 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | pub use typespec_client_core::http::Etag; 5 | -------------------------------------------------------------------------------- /sdk/keyvault/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "TagPrefix": "rust/keyvault", 5 | "Tag": "rust/keyvault_7638924b53" 6 | } 7 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/http/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | mod etag; 5 | 6 | pub use etag::*; 7 | -------------------------------------------------------------------------------- /sdk/eventhubs/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "TagPrefix": "rust/eventhubs", 5 | "Tag": "rust/eventhubs_ad9b84912d" 6 | } 7 | -------------------------------------------------------------------------------- /sdk/cosmos/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "Tag": "rust/azure_data_cosmos_a39b424a5b", 5 | "TagPrefix": "rust/azure_data_cosmos" 6 | } -------------------------------------------------------------------------------- /sdk/core/azure_core_test/src/docs/root_readme.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc(include_str = "../../../../../README.md")] 5 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary/README.md: -------------------------------------------------------------------------------- 1 | # Azure Canary client library for Rust 2 | 3 | > Canary crate for Azure SDK pipeline testing and to showcase various rust themes/concepts to use as a testing ground for the rust-api-parser. 4 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test/src/http/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! HTTP testing utilities. 5 | mod clients; 6 | 7 | pub use clients::*; 8 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/tsp-location.yaml: -------------------------------------------------------------------------------- 1 | directory: specification/storage/Microsoft.BlobStorage 2 | commit: 05825b05cc9c70823a39aee77cd0f76c7e5d0eee 3 | repo: Azure/azure-rest-api-specs 4 | additionalDirectories: 5 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/tsp-location.yaml: -------------------------------------------------------------------------------- 1 | directory: specification/storage/Microsoft.QueueStorage 2 | commit: 00396ee435c1726be4132dfe477775e8353c6193 3 | repo: Azure/azure-rest-api-specs 4 | additionalDirectories: 5 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/error/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Client-specific error functions. 5 | 6 | pub use typespec::error::*; 7 | -------------------------------------------------------------------------------- /sdk/servicebus/.dict.txt: -------------------------------------------------------------------------------- 1 | amqps 2 | azuremessagingservicebus 3 | backoff 4 | mybus 5 | myqueue 6 | myservicebus 7 | retryable 8 | Retryable 9 | SubQueue 10 | subqueues 11 | testqueue 12 | testtopic 13 | testsubscription 14 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/src/routing/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | pub(crate) mod global_endpoint_manager; 5 | pub(crate) mod location_cache; 6 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "Tag": "rust/azure_storage_blob_c75e43d992", 5 | "TagPrefix": "rust/azure_storage_blob" 6 | } 7 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "Tag": "rust/azure_storage_queue_b234d5c152", 5 | "TagPrefix": "rust/azure_storage_queue" 6 | } 7 | -------------------------------------------------------------------------------- /sdk/core/azure_core_opentelemetry/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "Tag": "rust/azure_core_opentelemetry_341a93c45d", 5 | "TagPrefix": "rust/azure_core_opentelemetry" 6 | } -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/src/handler/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Handler types for request processing and retry logic. 5 | pub(crate) mod retry_handler; 6 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "AssetsRepo": "Azure/azure-sdk-assets", 3 | "AssetsRepoPrefixPath": "rust", 4 | "Tag": "rust/azure_messaging_eventhubs_e03970e909", 5 | "TagPrefix": "rust/azure_messaging_eventhubs" 6 | } -------------------------------------------------------------------------------- /eng/dict/rust-custom.txt: -------------------------------------------------------------------------------- 1 | bindgen 2 | cfg 3 | cfgs 4 | consts 5 | deque 6 | impls 7 | newtype 8 | oneshot 9 | repr 10 | rustc 11 | rustflags 12 | rustls 13 | rustsec 14 | turbofish 15 | uninit 16 | dylib 17 | cdylib 18 | staticlib 19 | cbindgen 20 | -------------------------------------------------------------------------------- /eng/pipelines/templates/variables/globals.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | skipComponentGovernanceDetection: true 3 | # Disable CodeQL injections except for where we specifically enable it 4 | Codeql.SkipTaskAutoInjection: true 5 | ComponentDetection.Timeout: 1200 -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/request/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! HTTP requests. 5 | 6 | pub mod options; 7 | 8 | pub use typespec_client_core::http::request::*; 9 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/pipeline/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | mod storage_headers_policy; 5 | 6 | pub use storage_headers_policy::StorageHeadersPolicy; 7 | -------------------------------------------------------------------------------- /sdk/identity/.dict.txt: -------------------------------------------------------------------------------- 1 | AADSTS 2 | adfs 3 | appservice 4 | azureauth 5 | clientcertificate 6 | clientsecret 7 | cloudshell 8 | imds 9 | LINUXPOOL 10 | LINUXVMIMAGE 11 | managedidentity 12 | msal 13 | replacen 14 | SYSTEMROOT 15 | workloadidentity 16 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_common/README.md: -------------------------------------------------------------------------------- 1 | # Common Utilities for Azure Storage Libraries 2 | 3 | This crate supports the following Azure Storage crates: 4 | 5 | - [azure_storage_blob](https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_blob) 6 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/error/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Error types and handling. 5 | pub use typespec_client_core::error::*; 6 | mod error_response; 7 | 8 | pub use error_response::*; 9 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/http/headers/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! HTTP headers. 5 | 6 | mod common; 7 | 8 | pub use common::*; 9 | pub use typespec::http::headers::*; 10 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/src/utils.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | pub fn url_encode(s: impl AsRef<[u8]>) -> String { 5 | url::form_urlencoded::byte_serialize(s.as_ref()).collect::() 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "editorconfig.editorconfig", 4 | "GitHub.copilot", 5 | "rust-lang.rust-analyzer", 6 | "streetsidesoftware.code-spell-checker", 7 | "tamasfe.even-better-toml", 8 | "vadimcn.vscode-lldb" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /eng/common/scripts/Import-AzModules.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param ( 3 | [string]$AzModuleVersion = "5.7.0" # Current version cached on agents 4 | ) 5 | 6 | . (Join-Path $PSScriptRoot Helpers PSModule-Helpers.ps1) 7 | 8 | Install-ModuleIfNotInstalled "Az" $AzModuleVersion | Import-Module 9 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml: -------------------------------------------------------------------------------- 1 | directory: specification/keyvault/Security.KeyVault.Keys 2 | commit: 39b2bb6b46f241309c56ad31a88aaee910578036 3 | repo: Azure/azure-rest-api-specs 4 | additionalDirectories: 5 | - specification/keyvault/Security.KeyVault.Common/ 6 | -------------------------------------------------------------------------------- /eng/common/scripts/job-matrix/README.md: -------------------------------------------------------------------------------- 1 | # Azure Pipelines Matrix Generator 2 | 3 | The documentation for Azure Pipelines Matrix Generator can be found at 4 | 5 | [`azure-sdk-tools/doc/common/matrix_generator.md`](https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/matrix_generator.md) 6 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/tsp-location.yaml: -------------------------------------------------------------------------------- 1 | directory: specification/keyvault/Security.KeyVault.Secrets 2 | commit: 39b2bb6b46f241309c56ad31a88aaee910578036 3 | repo: Azure/azure-rest-api-specs 4 | additionalDirectories: 5 | - specification/keyvault/Security.KeyVault.Common/ 6 | -------------------------------------------------------------------------------- /sdk/core/azure_core_opentelemetry/examples/basic_usage.rs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | fn main() -> Result<(), Box> { 5 | println!("Tracing example completed successfully!"); 6 | 7 | Ok(()) 8 | } 9 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test/src/docs/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Tests for other documentation examples in the [Azure/azure-sdk-for-rust](https://github.com/Azure/azure-sdk-for-rust) repository. 5 | 6 | mod root_readme; 7 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_certificates/tsp-location.yaml: -------------------------------------------------------------------------------- 1 | directory: specification/keyvault/Security.KeyVault.Certificates 2 | commit: 6c25a1834c32a6810e9b9408b3a2899ecb7dc66c 3 | repo: Azure/azure-rest-api-specs 4 | additionalDirectories: 5 | - specification/keyvault/Security.KeyVault.Common 6 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/write-filesystemmetrics.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: Powershell@2 3 | inputs: 4 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Write-FileSystemMetrics.ps1 5 | pwsh: true 6 | displayName: Write filesystem metrics 7 | continueOnError: true 8 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/examples/README.md: -------------------------------------------------------------------------------- 1 | # Storage Queue Examples 2 | 3 | This directory contains a set of example for the use of the Storage Queue clients. 4 | 5 | ## Setup 6 | 7 | The following environment variables need to be set: 8 | 9 | - `AZURE_QUEUE_STORAGE_ACCOUNT_NAME=` 10 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/perf-tests.yml: -------------------------------------------------------------------------------- 1 | Service: azure_security_keyvault_keys 2 | 3 | Project: azure_security_keyvault_keys 4 | 5 | PackageVersions: 6 | - azure_security_keyvault_keys: source 7 | 8 | Tests: 9 | - Test: get_key 10 | Class: get_key 11 | Arguments: 12 | - --parallel 4 13 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/policies/auth/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Authentication pipeline policies. 5 | 6 | mod bearer_token_policy; 7 | 8 | pub use bearer_token_policy::{Authorizer, BearerTokenAuthorizationPolicy, OnChallenge, OnRequest}; 9 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | pub fn main() { 5 | // Force a rebuild of this package, and thus anything dependent upon it, if AZURE_TEST_MODE changes. 6 | println!("cargo::rerun-if-env-changed=AZURE_TEST_MODE"); 7 | } 8 | -------------------------------------------------------------------------------- /eng/common/scripts/trust-proxy-certificate.ps1: -------------------------------------------------------------------------------- 1 | . $PSScriptRoot/common.ps1 2 | 3 | if ($TestProxyTrustCertFn -and (Test-Path "Function:$TestProxyTrustCertFn")) 4 | { 5 | &$TestProxyTrustCertFn 6 | } 7 | else 8 | { 9 | Write-Host "No implementation of Import-Dev-Cert- provided in eng/scripts/Language-Settings.ps1." 10 | } -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/perf-tests.yml: -------------------------------------------------------------------------------- 1 | Service: azure_security_keyvault_secrets 2 | 3 | Project: azure_security_keyvault_secrets 4 | 5 | PackageVersions: 6 | - azure_security_keyvault_secrets: source 7 | 8 | Tests: 9 | - Test: get_secret 10 | Class: get_secret 11 | Arguments: 12 | - --parallel 4 13 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye 2 | 3 | USER vscode 4 | 5 | # Install nightly toolchain to give access to nightly features for docs-site build. 6 | RUN rustup toolchain install nightly 7 | 8 | # Install pre-requisite tools 9 | RUN cargo install \ 10 | cargo-watch \ 11 | http-server 12 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | 7 | mod generated; 8 | mod resource; 9 | 10 | pub use generated::*; 11 | pub use resource::*; 12 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/docs/control-plane-warning.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | This is a control-plane API and requires that you authenticate using a key. To use Entra ID to perform this operation, you must use the [Azure Resource Manager APIs](https://learn.microsoft.com/azure/templates/microsoft.documentdb/databaseaccounts). 4 | 5 |
6 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | 7 | mod generated; 8 | mod resource; 9 | 10 | pub use generated::*; 11 | pub use resource::*; 12 | -------------------------------------------------------------------------------- /.taplo.toml: -------------------------------------------------------------------------------- 1 | [formatting] 2 | align_single_comments = false 3 | array_auto_collapse = false 4 | array_trailing_comma = true 5 | indent_string = " " 6 | 7 | [[rule]] 8 | include = ["**/Cargo.toml"] 9 | keys = [ 10 | "dependencies", 11 | "build-dependencies", 12 | "dev-dependencies", 13 | ] 14 | 15 | [rule.formatting] 16 | reorder_keys = true 17 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod key_client; 7 | pub use key_client::*; 8 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/src/generated/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod secret_client; 7 | pub use secret_client::*; 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Don't allow people to merge changes to these generated files, because the result 2 | # may be invalid. You need to run "cargo update" again. 3 | Cargo.lock merge=binary 4 | 5 | *package-lock.json merge=binary 6 | 7 | # Use unix line endings everywhere, even on Windows 8 | * text=auto eol=lf 9 | sdk/**/src/generated/**/*.rs linguist-generated=true 10 | -------------------------------------------------------------------------------- /eng/pipelines/pullrequest.yml: -------------------------------------------------------------------------------- 1 | trigger: none 2 | 3 | pr: 4 | branches: 5 | include: 6 | - main 7 | - feature/* 8 | - hotfix/* 9 | - release/* 10 | 11 | extends: 12 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 13 | parameters: 14 | ServiceDirectory: auto 15 | IncludeRelease: false 16 | RunLiveTests: false 17 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_certificates/src/generated/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod certificate_client; 7 | pub use certificate_client::*; 8 | -------------------------------------------------------------------------------- /sdk/core/typespec/README.md: -------------------------------------------------------------------------------- 1 | # typespec 2 | 3 | Project [root crate](https://rust-lang.github.io/rfcs/3243-packages-as-optional-namespaces.html) for all [TypeSpec](https://typespec.io)-related crates. 4 | 5 | ## Features 6 | 7 | * `amqp`: enables AMQP support. 8 | * `http` (default): enables HTTP support. 9 | * `json` (default): enables JSON support. 10 | * `xml`: enables XML support. 11 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/src/common/recoverable/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | mod claims_based_security; 5 | mod connection; 6 | mod management; 7 | mod receiver; 8 | mod sender; 9 | 10 | pub(crate) use connection::RecoverableConnection; 11 | pub(crate) use sender::RecoverableSender; 12 | -------------------------------------------------------------------------------- /eng/common/README.md: -------------------------------------------------------------------------------- 1 | # Common Engineering System 2 | 3 | Updates under this directory should only be made in the `azure-sdk-tools` repo as any changes under this directory outside of that repo will end up getting overwritten with future updates. For information about making updates see [common engineering system docs](https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/common_engsys.md) 4 | -------------------------------------------------------------------------------- /sdk/core/azure_core_amqp/src/fe2o3/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | pub(crate) mod cbs; 4 | pub(crate) mod connection; 5 | pub(crate) mod error; 6 | pub(crate) mod management; 7 | pub(crate) mod messaging; 8 | pub(crate) mod receiver; 9 | pub(crate) mod sender; 10 | pub(crate) mod session; 11 | pub(crate) mod value; 12 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/src/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | mod queue_client; 5 | pub use queue_client::QueueClient; 6 | 7 | mod queue_service_client; 8 | pub use queue_service_client::QueueServiceClient; 9 | 10 | pub use crate::generated::clients::{QueueClientOptions, QueueServiceClientOptions}; 11 | -------------------------------------------------------------------------------- /sdk/core/azure_core/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use rustc_version::version; 5 | 6 | fn main() { 7 | let version = match version() { 8 | Ok(version) => version.to_string(), 9 | Err(_) => "unknown".to_owned(), 10 | }; 11 | println!("cargo:rustc-env=AZSDK_RUSTC_VERSION={version}"); 12 | } 13 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs_checkpointstore_blob/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![recursion_limit = "128"] 5 | #![warn(missing_docs)] 6 | #![doc = include_str!("../README.md")] 7 | #![cfg_attr(docsrs, feature(doc_cfg))] 8 | 9 | pub mod checkpoint_store; 10 | pub use checkpoint_store::BlobCheckpointStore; 11 | -------------------------------------------------------------------------------- /sdk/servicebus/azure_messaging_servicebus/src/common/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | //! Common functionality for Service Bus. 5 | 6 | /// Authorization functionality for Service Bus operations. 7 | /// 8 | /// Handles Entra ID authentication tokens and automatic token refresh for Service Bus resources. 9 | pub mod authorizer; 10 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | use rustc_version::version; 5 | 6 | fn main() { 7 | let version = match version() { 8 | Ok(version) => version.to_string(), 9 | Err(_) => "unknown".to_owned(), 10 | }; 11 | println!("cargo:rustc-env=AZSDK_RUSTC_VERSION={version}"); 12 | } 13 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/src/generated/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod queue_client; 7 | mod queue_service_client; 8 | pub use queue_client::*; 9 | pub use queue_service_client::*; 10 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/src/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Clients used to communicate with Azure Cosmos DB 5 | 6 | mod container_client; 7 | mod cosmos_client; 8 | mod database_client; 9 | 10 | pub use container_client::ContainerClient; 11 | pub use cosmos_client::CosmosClient; 12 | pub use database_client::DatabaseClient; 13 | -------------------------------------------------------------------------------- /eng/common/testproxy/test-proxy-tool-shutdown.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - pwsh: | 3 | Stop-Process -Id $(PROXY_PID) 4 | displayName: 'Shut down the testproxy - windows' 5 | condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT')) 6 | 7 | - bash: | 8 | kill -9 $(PROXY_PID) 9 | displayName: "Shut down the testproxy - linux/mac" 10 | condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT')) 11 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/policies/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! HTTP pipeline policies. 5 | 6 | pub mod auth; 7 | mod client_request_id; 8 | mod instrumentation; 9 | mod user_agent; 10 | 11 | pub use client_request_id::*; 12 | pub use instrumentation::*; 13 | pub use typespec_client_core::http::policies::*; 14 | pub use user_agent::*; 15 | -------------------------------------------------------------------------------- /sdk/cosmos/.dict.txt: -------------------------------------------------------------------------------- 1 | colls 2 | documentdb 3 | dotproduct 4 | euclidian 5 | pkranges 6 | sprocs 7 | udfs 8 | backoff 9 | pluggable 10 | cloneable 11 | moka 12 | substatus 13 | retryable 14 | 15 | # Cosmos' docs all use "Autoscale" as a single word, rather than a compound "AutoScale" or "Auto Scale" 16 | autoscale 17 | 18 | # Words used within the Cosmos Native Client (azure_data_cosmos_native) 19 | azurecosmos 20 | cosmosclient 21 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/perf-tests.yml: -------------------------------------------------------------------------------- 1 | Service: azure_messaging_eventhubs 2 | 3 | Project: azure_messaging_eventhubs 4 | 5 | PackageVersions: 6 | - azure_messaging_eventhubs: source 7 | 8 | Tests: 9 | - Test: eventhubs_send_batch 10 | Class: eventhubs_send_batch 11 | Arguments: 12 | - --sync 13 | 14 | - Test: eventhubs_send 15 | Class: eventhubs_send 16 | Arguments: 17 | - --sync 18 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_storage_common" 3 | version = "0.1.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | rust-version.workspace = true 9 | 10 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 11 | 12 | [dependencies] 13 | 14 | [lints] 15 | workspace = true 16 | -------------------------------------------------------------------------------- /.devcontainer/oncreate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | echo "Running Azure SDK for Rust devcontainer post create script..." 6 | 7 | echo "Updating toolchains..." 8 | rustup install 9 | 10 | echo "Installing test-proxy..." 11 | dotnet tool update azure.sdk.tools.testproxy --global --prerelease --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --ignore-failed-sources 12 | -------------------------------------------------------------------------------- /sdk/core/azure_core_opentelemetry/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | #![warn(missing_docs)] 7 | 8 | mod attributes; 9 | mod span; 10 | mod telemetry; 11 | mod tracer; 12 | 13 | // Re-export the main types for convenience 14 | pub use telemetry::OpenTelemetryTracerProvider; 15 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary_core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_canary_core" 3 | version = "0.1.0" 4 | description = "Canary crate for Azure SDK pipeline testing" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | rust-version.workspace = true 10 | 11 | [dependencies] 12 | 13 | [dev-dependencies] 14 | azure_canary.path = "../azure_canary" 15 | 16 | [lints] 17 | workspace = true 18 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/options/instrumentation.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use std::sync::Arc; 5 | 6 | /// Policy options to enable distributed tracing. 7 | #[derive(Clone, Debug, Default)] 8 | pub struct InstrumentationOptions { 9 | /// Set the tracer provider for distributed tracing. 10 | pub tracer_provider: Option>, 11 | } 12 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/enable-long-path-support.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - pwsh: | 3 | if ($IsWindows) { 4 | REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /f /v LongPathsEnabled /t REG_DWORD /d 1 5 | git config --system core.longpaths true 6 | } 7 | else { 8 | Write-Host "This script is not executing on Windows, skipping registry modification." 9 | } 10 | displayName: Enable long path support if necessary 11 | -------------------------------------------------------------------------------- /eng/tools/generate_api_report/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "generate_api_report" 3 | authors = ["Microsoft"] 4 | edition = "2021" 5 | license = "MIT" 6 | repository = "https://github.com/azure/azure-sdk-for-rust" 7 | rust-version = "1.85" 8 | 9 | [build-dependencies] 10 | serde = { version = "1.0", features = ["derive"] } 11 | toml = "0.8.20" 12 | 13 | [dependencies] 14 | rustdoc-types = "0.33.0" 15 | serde_json = "1.0" 16 | toml = "0.8.20" 17 | 18 | [workspace] 19 | -------------------------------------------------------------------------------- /eng/common/scripts/check-for-git-changes.ps1: -------------------------------------------------------------------------------- 1 | echo "git add -A" 2 | git add -A 3 | 4 | echo "git diff --name-status --cached --exit-code" 5 | git diff --name-status --cached --exit-code 6 | 7 | if ($LastExitCode -ne 0) { 8 | echo "##vso[task.setvariable variable=HasChanges]$true" 9 | echo "Changes detected so setting HasChanges=true" 10 | } 11 | else { 12 | echo "##vso[task.setvariable variable=HasChanges]$false" 13 | echo "No changes so skipping code push" 14 | } 15 | -------------------------------------------------------------------------------- /eng/pipelines/pr.yml: -------------------------------------------------------------------------------- 1 | # DEPRECATED - This file is replaced by ./pullrequest.yml 2 | # Once all PRs contain the new file, the pipeline can target the new file and this file can be deleted. 3 | trigger: none 4 | 5 | pr: 6 | branches: 7 | include: 8 | - main 9 | - feature/* 10 | - hotfix/* 11 | - release/* 12 | 13 | extends: 14 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 15 | parameters: 16 | ServiceDirectory: auto 17 | -------------------------------------------------------------------------------- /eng/common/TestResources/clouds/AzureCloud.json: -------------------------------------------------------------------------------- 1 | { 2 | "azureAuthorityHost": "https://login.microsoftonline.com/", 3 | "cognitiveServicesEndpointSuffix": ".cognitiveservices.azure.com", 4 | "communicationServicesEndpointSuffix": ".communication.azure.com", 5 | "cosmosEndpointSuffix": "cosmos.azure.com", 6 | "keyVaultDomainSuffix": ".vault.azure.net", 7 | "keyVaultEndpointSuffix": ".vault.azure.net", 8 | "storageEndpointSuffix": "core.windows.net" 9 | } 10 | -------------------------------------------------------------------------------- /sdk/core/typespec/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | #![warn(missing_docs)] 7 | 8 | pub mod error; 9 | #[cfg(feature = "http")] 10 | pub mod http; 11 | #[cfg(feature = "json")] 12 | pub mod json; 13 | #[cfg(feature = "xml")] 14 | pub mod xml; 15 | 16 | pub use bytes::Bytes; 17 | pub use error::{Error, Result}; 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_canary" 3 | version = "0.1.0" 4 | description = "Canary crate for Azure SDK pipeline testing" 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | rust-version.workspace = true 10 | 11 | [dependencies] 12 | azure_canary_core = { path = "../azure_canary_core", version = "0.1.0" } 13 | serde = { version = "1", features = ["derive"] } 14 | 15 | [lints] 16 | workspace = true 17 | -------------------------------------------------------------------------------- /sdk/servicebus/azure_messaging_servicebus/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release History 2 | 3 | ## 0.1.0 (Unreleased) 4 | 5 | ### Features Added 6 | 7 | - Initial release of Azure Service Bus client library for Rust 8 | - Support for sending and receiving messages from Service Bus queues and topics 9 | - Support for session-enabled entities 10 | - Support for dead letter queues 11 | - AMQP-based implementation using azure_core_amqp 12 | 13 | ### Breaking Changes 14 | 15 | ### Bugs Fixed 16 | 17 | ### Other Changes 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | file_header_template = Copyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the MIT License. 5 | insert_final_newline = true 6 | indent_size = 4 7 | indent_style = space 8 | trim_trailing_whitespace = true 9 | 10 | [*.bicep] 11 | indent_size = 2 12 | 13 | [*.json] 14 | indent_size = 2 15 | 16 | [*.ps1] 17 | indent_size = 2 18 | 19 | [*.rs] 20 | end_of_line = lf 21 | 22 | [*.toml] 23 | indent_size = 2 24 | 25 | [*.{yaml,yml}] 26 | indent_size = 2 27 | -------------------------------------------------------------------------------- /eng/CredScanSuppression.json: -------------------------------------------------------------------------------- 1 | { 2 | "tool": "Credential Scanner", 3 | "suppressions": [ 4 | { 5 | "placeholder": [ 6 | "placeholder" 7 | ], 8 | "_justification": "Secret used by test code, it is fake." 9 | }, 10 | { 11 | "file": [ 12 | "eng/common/testproxy/dotnet-devcert.pfx" 13 | ], 14 | "_justification": "File contains private key used by test code." 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /eng/common/scripts/Update-GeneratedSdks.ps1: -------------------------------------------------------------------------------- 1 | [CmdLetBinding()] 2 | param( 3 | [Parameter(Mandatory)] 4 | [string]$PackageDirectoriesFile 5 | ) 6 | 7 | . $PSScriptRoot/common.ps1 8 | . $PSScriptRoot/Helpers/CommandInvocation-Helpers.ps1 9 | 10 | $ErrorActionPreference = 'Stop' 11 | 12 | if (Test-Path "Function:$UpdateGeneratedSdksFn") { 13 | &$UpdateGeneratedSdksFn $PackageDirectoriesFile 14 | } else { 15 | Write-Error "Function $UpdateGeneratedSdksFn not implemented in Language-Settings.ps1" 16 | } 17 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs_checkpointstore_blob/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release History 2 | 3 | ## 0.4.0 (Unreleased) 4 | 5 | ### Features Added 6 | 7 | ### Breaking Changes 8 | 9 | ### Bugs Fixed 10 | 11 | ### Other Changes 12 | 13 | ## 0.3.0 (2025-11-11) 14 | 15 | ### Other Changes 16 | 17 | - Updated dependencies. 18 | 19 | ## 0.2.0 (2025-10-08) 20 | 21 | ### Other Changes 22 | 23 | - Updated dependencies. 24 | 25 | ## 0.1.0 (2025-09-16) 26 | 27 | ### Features Added 28 | 29 | - Initial Release 30 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/src/generated/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod enums; 7 | mod enums_impl; 8 | mod enums_serde; 9 | mod method_options; 10 | mod models_impl; 11 | mod pub_models; 12 | pub use enums::*; 13 | pub use method_options::*; 14 | pub use pub_models::*; 15 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/src/generated/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod enums; 7 | mod enums_impl; 8 | mod enums_serde; 9 | mod method_options; 10 | mod models_impl; 11 | mod pub_models; 12 | pub use enums::*; 13 | pub use method_options::*; 14 | pub use pub_models::*; 15 | -------------------------------------------------------------------------------- /eng/common/TestResources/New-TestResources.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Copyright (c) Microsoft Corporation. All rights reserved. 4 | REM Licensed under the MIT License. 5 | 6 | setlocal 7 | 8 | for /f "usebackq delims=" %%i in (`where pwsh 2^>nul`) do ( 9 | set _cmd=%%i 10 | ) 11 | 12 | if "%_cmd%"=="" ( 13 | echo Error: PowerShell not found. Please visit https://github.com/powershell/powershell for install instructions. 14 | exit /b 2 15 | ) 16 | 17 | call "%_cmd%" -NoLogo -NoProfile -File "%~dpn0.ps1" %* 18 | -------------------------------------------------------------------------------- /eng/common/TestResources/Remove-TestResources.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Copyright (c) Microsoft Corporation. All rights reserved. 4 | REM Licensed under the MIT License. 5 | 6 | setlocal 7 | 8 | for /f "usebackq delims=" %%i in (`where pwsh 2^>nul`) do ( 9 | set _cmd=%%i 10 | ) 11 | 12 | if "%_cmd%"=="" ( 13 | echo Error: PowerShell not found. Please visit https://github.com/powershell/powershell for install instructions. 14 | exit /b 2 15 | ) 16 | 17 | call "%_cmd%" -NoLogo -NoProfile -File "%~dpn0.ps1" %* 18 | -------------------------------------------------------------------------------- /eng/common/TestResources/Update-TestResources.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Copyright (c) Microsoft Corporation. All rights reserved. 4 | REM Licensed under the MIT License. 5 | 6 | setlocal 7 | 8 | for /f "usebackq delims=" %%i in (`where pwsh 2^>nul`) do ( 9 | set _cmd=%%i 10 | ) 11 | 12 | if "%_cmd%"=="" ( 13 | echo Error: PowerShell not found. Please visit https://github.com/powershell/powershell for install instructions. 14 | exit /b 2 15 | ) 16 | 17 | call "%_cmd%" -NoLogo -NoProfile -File "%~dpn0.ps1" %* 18 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/macros.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /// Defines a static `Url`. 5 | #[macro_export] 6 | macro_rules! static_url { 7 | ( $(#[$outer:meta])* $name:ident, $value:expr) => { 8 | $(#[$outer])* 9 | pub static $name: ::std::sync::LazyLock<$crate::http::Url> = ::std::sync::LazyLock::new(|| { 10 | $crate::http::Url::parse($value).expect("hardcoded URL must parse") 11 | }); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /sdk/keyvault/.dict.txt: -------------------------------------------------------------------------------- 1 | canonicalizes 2 | cbcpad 3 | ciphertext 4 | ckmaeskeywrap 5 | ckmaeskeywrappad 6 | ckmrsaaeskeywrap 7 | deletedcertificates 8 | deleteissuers 9 | deletedkeys 10 | deletedsecrets 11 | diffie 12 | echsm 13 | ekus 14 | fips 15 | getissuers 16 | innererror 17 | keyout 18 | managecontacts 19 | manageissuers 20 | newkey 21 | oaep 22 | purgeable 23 | rotationpolicy 24 | rsaaeskeywrap 25 | rsaes 26 | rsahsm 27 | rsaoaep 28 | rsassa 29 | rsnull 30 | secg 31 | secp 32 | setissuers 33 | unwrapkey 34 | upns 35 | wrapkey 36 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | /// Clients used to communicate with the service. 7 | pub mod clients; 8 | /// Contains all the data structures and types used by the client library. 9 | pub mod models; 10 | pub use clients::{KeyClient, KeyClientOptions}; 11 | -------------------------------------------------------------------------------- /eng/common/scripts/get-markdown-files-from-changed-files.ps1: -------------------------------------------------------------------------------- 1 | # cSpell:ignore Committish 2 | # cSpell:ignore PULLREQUEST 3 | # cSpell:ignore TARGETBRANCH 4 | param ( 5 | # The root repo we scanned with. 6 | [string] $RootRepo = '$PSScriptRoot/../../..', 7 | # The target branch to compare with. 8 | [string] $targetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "/refs/heads/") 9 | ) 10 | 11 | . (Join-Path $PSScriptRoot common.ps1) 12 | 13 | return Get-ChangedFiles -TargetCommittish $targetBranch -DiffPath '*.md' 14 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | /// Clients used to communicate with the service. 7 | pub mod clients; 8 | /// Contains all the data structures and types used by the client library. 9 | pub mod models; 10 | pub use clients::{SecretClient, SecretClientOptions}; 11 | -------------------------------------------------------------------------------- /sdk/core/typespec/src/http/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! This module contains types and utilities for working with HTTP status codes. 5 | 6 | pub mod headers; 7 | pub mod response; 8 | mod status_code; 9 | 10 | pub use headers::DEFAULT_ALLOWED_HEADER_NAMES; 11 | pub use response::RawResponse; 12 | pub use status_code::StatusCode; 13 | 14 | /// Default pattern for redacted headers or query parameters. 15 | pub const REDACTED_PATTERN: &str = "REDACTED"; 16 | -------------------------------------------------------------------------------- /sdk/identity/azure_identity/managed-identity-matrix.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | { 4 | "Agent": { 5 | "msi_image": { 6 | "ArmTemplateParameters": "@{deployResources = $true}", 7 | "OSVmImage": "env:LINUXVMIMAGE", 8 | "Pool": "env:LINUXPOOL" 9 | } 10 | }, 11 | "IDENTITY_IMDS_AVAILABLE": "1", 12 | "RustToolchainName": [ 13 | "stable" 14 | ] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_certificates/src/generated/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod enums; 7 | mod enums_impl; 8 | mod enums_serde; 9 | mod method_options; 10 | mod models_impl; 11 | mod models_serde; 12 | mod pub_models; 13 | pub use enums::*; 14 | pub use method_options::*; 15 | pub use pub_models::*; 16 | -------------------------------------------------------------------------------- /sdk/storage/.dict.txt: -------------------------------------------------------------------------------- 1 | AAABBBCCC 2 | appendblock 3 | appendpos 4 | blockid 5 | blocklist 6 | blocklisttype 7 | Btext 8 | copyid 9 | deletedwithversions 10 | deletetype 11 | firsttag 12 | immutabilitypolicy 13 | incrementalcopy 14 | legalhold 15 | missingcontainer 16 | numofmessages 17 | pagelist 18 | peekonly 19 | policyid 20 | prevsnapshot 21 | RAGRS 22 | restype 23 | ruleid 24 | secondtag 25 | subsecond 26 | testblob1 27 | testblob2 28 | testblob3 29 | testblob4 30 | testcontainer 31 | uncommittedblobs 32 | Undeletes 33 | westus 34 | yourtagname 35 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/bypass-local-dns.yml: -------------------------------------------------------------------------------- 1 | 2 | steps: 3 | # https://github.com/actions/virtual-environments/issues/798 4 | - script: sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf 5 | displayName: Bypass local DNS server to workaround issue resolving cognitiveservices names 6 | condition: | 7 | and( 8 | succeededOrFailed(), 9 | or(contains(variables['OSVmImage'], 'ubuntu'),contains(variables['OSVmImage'], 'linux')), 10 | eq(variables['Container'], '') 11 | ) 12 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_certificates/src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | /// Clients used to communicate with the service. 7 | pub mod clients; 8 | /// Contains all the data structures and types used by the client library. 9 | pub mod models; 10 | pub use clients::{CertificateClient, CertificateClientOptions}; 11 | -------------------------------------------------------------------------------- /eng/cgmanifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/component-detection-manifest.json", 3 | "version": 1, 4 | "registrations": [ 5 | { 6 | "component": { 7 | "type": "cargo", 8 | "cargo": { "name": "cargo-semver-checks", "version": "0.45.0" } 9 | }, 10 | "developmentDependency": true 11 | }, 12 | { 13 | "component": { 14 | "type": "cargo", 15 | "cargo": { "name": "cargo-audit", "version": "0.22.0" } 16 | }, 17 | "developmentDependency": true 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /sdk/identity/azure_identity/tests/default_options_test.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use azure_identity::{AzureCliCredentialOptions, AzureDeveloperCliCredentialOptions}; 5 | 6 | #[test] 7 | fn az_credential_options() { 8 | let _options = AzureCliCredentialOptions { 9 | ..Default::default() 10 | }; 11 | } 12 | 13 | #[test] 14 | fn azd_credential_options() { 15 | let _options = AzureDeveloperCliCredentialOptions { 16 | ..Default::default() 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_certificates/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | 7 | pub mod clients; 8 | #[allow( 9 | unused_imports, 10 | reason = "Publicly exported generated/clients are instead exported from clients" 11 | )] 12 | mod generated; 13 | pub mod models; 14 | mod resource; 15 | 16 | pub use clients::{CertificateClient, CertificateClientOptions}; 17 | pub use resource::*; 18 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | /// Clients used to communicate with the service. 7 | pub mod clients; 8 | /// Contains all the data structures and types used by the client library. 9 | pub mod models; 10 | pub use clients::{QueueClient, QueueClientOptions, QueueServiceClient, QueueServiceClientOptions}; 11 | -------------------------------------------------------------------------------- /eng/emitter-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "dist/src/index.js", 3 | "dependencies": { 4 | "@azure-tools/typespec-rust": "0.32.0" 5 | }, 6 | "devDependencies": { 7 | "@azure-tools/typespec-azure-core": "~0.63.0", 8 | "@azure-tools/typespec-azure-rulesets": "~0.63.0", 9 | "@azure-tools/typespec-client-generator-core": "~0.63.0", 10 | "@typespec/compiler": "^1.7.0", 11 | "@typespec/http": "^1.7.0", 12 | "@typespec/openapi": "^1.7.0", 13 | "@typespec/rest": "~0.77.0", 14 | "@typespec/versioning": "~0.77.0", 15 | "@typespec/xml": "~0.77.0" 16 | } 17 | } -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/docsms-ensure-validation.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | # Fail the build if any of the packages failed validation. Valid values are 3 | # "true" or "false". This step will skip if $(DocsMsPackagesAllValid) is not set 4 | - pwsh: | 5 | if ('$(DocsMsPackagesAllValid)' -eq 'true') { 6 | Write-Host "All packages passed validation." 7 | } else { 8 | Write-Error "Some packages failed validation." 9 | exit 1 10 | } 11 | displayName: Check package validation results 12 | condition: and(succeeded(), ne(variables['DocsMsPackagesAllValid'], '')) 13 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/perf/perf_tests.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /// list_blob performance test. 5 | mod list_blob_test; 6 | 7 | use azure_core_test::perf::PerfRunner; 8 | use list_blob_test::ListBlobTest; 9 | 10 | #[tokio::main] 11 | async fn main() -> azure_core::Result<()> { 12 | let runner = PerfRunner::new( 13 | env!("CARGO_MANIFEST_DIR"), 14 | file!(), 15 | vec![ListBlobTest::test_metadata()], 16 | )?; 17 | 18 | runner.run().await?; 19 | 20 | Ok(()) 21 | } 22 | -------------------------------------------------------------------------------- /doc/dev/README.md: -------------------------------------------------------------------------------- 1 | # Azure SDK for Rust – Development 2 | 3 | This folder collects in-progress developer documentation for contributors building Azure SDK clients, with a focus on management plane generation. Start with the guides below and follow the repository contribution docs for anything not covered here. 4 | 5 | - [Creating a TypeSpec-Based Client (Data & Management)](https://github.com/Azure/azure-sdk-for-rust/blob/main/doc/dev/typespec-based-generation.md) 6 | - [Generating Management Plane Crates from TypeSpec](https://github.com/Azure/azure-sdk-for-rust/blob/main/doc/dev/resourcemanager-generation.md) 7 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/http/request/options/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Options sent with requests to the service. 5 | 6 | #[macro_use] 7 | mod macros; 8 | 9 | use crate::http::headers::CONTENT_TYPE; 10 | 11 | request_header!( 12 | #[doc = "The Content Type indicates the media type of the request body"] 13 | ContentType, 14 | CONTENT_TYPE, 15 | ( 16 | #[doc = "The content type for JSON payloads"] 17 | APPLICATION_JSON, 18 | "application/json" 19 | ) 20 | ); 21 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/generated/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod enums; 7 | mod enums_impl; 8 | mod enums_serde; 9 | mod header_traits; 10 | mod method_options; 11 | mod models_impl; 12 | mod models_serde; 13 | mod pub_models; 14 | mod xml_helpers; 15 | pub use enums::*; 16 | pub use header_traits::*; 17 | pub use method_options::*; 18 | pub use pub_models::*; 19 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/src/generated/models/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod enums; 7 | mod enums_impl; 8 | mod enums_serde; 9 | mod header_traits; 10 | mod method_options; 11 | mod models_impl; 12 | mod models_serde; 13 | mod pub_models; 14 | mod xml_helpers; 15 | pub use enums::*; 16 | pub use header_traits::*; 17 | pub use method_options::*; 18 | pub use pub_models::*; 19 | -------------------------------------------------------------------------------- /sdk/core/azure_core/perf-tests.yml: -------------------------------------------------------------------------------- 1 | Service: core 2 | 3 | Project: azure_core_perf 4 | 5 | PrimaryPackage: azure_core 6 | 7 | PackageVersions: 8 | # - azure_core: 1.0.0 9 | - azure_core: source 10 | 11 | Tests: 12 | - Test: mock_json 13 | Class: mock_json 14 | Arguments: 15 | - --count 5 --parallel 64 16 | - --count 500 --parallel 32 17 | - --count 50000 --parallel 32 --warmup 60 --duration 60 18 | # - Test: mock_xml 19 | # Class: mock_xml 20 | # Arguments: 21 | # - --count 5 --parallel 64 22 | # - --count 500 --parallel 32 23 | # - --count 50000 --parallel 32 --warmup 60 --duration 60 24 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/verify-agent-os.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: ScriptDirectory 3 | type: string 4 | default: 'eng/common/scripts' 5 | - name: AgentImage 6 | type: string 7 | 8 | steps: 9 | - task: PowerShell@2 10 | displayName: Verify agent OS 11 | inputs: 12 | pwsh: true 13 | workingDirectory: $(System.DefaultWorkingDirectory) 14 | filePath: ${{ parameters.ScriptDirectory }}/Verify-AgentOS.ps1 15 | arguments: > 16 | -AgentImage "${{ parameters.AgentImage }}" 17 | 18 | - template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml 19 | -------------------------------------------------------------------------------- /eng/pipelines/templates/stages/platform-matrix.json: -------------------------------------------------------------------------------- 1 | { 2 | "displayNames": {}, 3 | "matrix": { 4 | "Agent": { 5 | "ubuntu": { 6 | "OSVmImage": "env:LINUXVMIMAGE", 7 | "Pool": "env:LINUXPOOL" 8 | }, 9 | "windows": { 10 | "OSVmImage": "env:WINDOWSVMIMAGE", 11 | "Pool": "env:WINDOWSPOOL" 12 | }, 13 | "macos": { 14 | "OSVmImage": "env:MACVMIMAGE", 15 | "Pool": "env:MACPOOL" 16 | } 17 | }, 18 | "RustToolchainName": [ 19 | "stable", 20 | "msrv", 21 | "nightly" 22 | ] 23 | }, 24 | "include": [] 25 | } 26 | -------------------------------------------------------------------------------- /sdk/core/perf-tests.yml: -------------------------------------------------------------------------------- 1 | Service: core 2 | 3 | Project: azure_core 4 | 5 | PackageVersions: 6 | - azure_core: source 7 | 8 | Tests: 9 | - Test: parse_basic_url 100 10 | Class: parse_basic_url_100 11 | Arguments: 12 | - --sync 13 | 14 | - Test: parse_basic_url_1000 15 | Class: parse_basic_url_1000 16 | Arguments: 17 | - --sync 18 | 19 | - Test: http_transport_get_async 20 | Class: http_transport_get_async 21 | Arguments: 22 | - --sync 23 | 24 | - Test: http_transport_post_async 25 | Class: http_transport_post_async 26 | Arguments: 27 | - --sync 28 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "label": "Start docs site (requires nightly)", 5 | "options": { 6 | "cwd": "${workspaceFolder}" 7 | }, 8 | "command": "cargo", 9 | "args": [ 10 | "watch", 11 | "-s", 12 | "RUSTDOCFLAGS=\"--cfg=docsrs --enable-index-page -Z unstable-options\" cargo +nightly doc --all-features --workspace --no-deps", 13 | "-s", 14 | "http-server --index --port 8080 ./target/doc" 15 | ], 16 | "isBackground": true, 17 | "problemMatcher": [ 18 | "$rustc" 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | #![doc = include_str!("../README.md")] 7 | #![allow(dead_code)] 8 | #![cfg_attr(docsrs, feature(doc_cfg))] 9 | 10 | pub mod clients; 11 | #[allow(unused_imports)] 12 | mod generated; 13 | mod parsers; 14 | mod partitioned_transfer; 15 | mod pipeline; 16 | mod streams; 17 | pub use clients::*; 18 | pub use parsers::*; 19 | pub mod models; 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # cSpell:ignore envrc 2 | 3 | # Build output. 4 | target/ 5 | 6 | # Track only workspace Cargo.lock 7 | Cargo.lock 8 | !/Cargo.lock 9 | 10 | # User secrets. 11 | .env 12 | .envrc 13 | 14 | # Test artifacts. 15 | .assets/ 16 | .proxy/ 17 | tests/data/ 18 | review/ 19 | results.json 20 | 21 | # Dependencies. 22 | vcpkg_installed/ 23 | 24 | # Editor user customizations. 25 | .vscode/launch.json 26 | .vscode/mcp.json 27 | .idea/ 28 | 29 | # Editor temp files. 30 | *~ 31 | *.code-workspace 32 | *.rs.bk 33 | *.swo 34 | *.swp 35 | *.vim 36 | 37 | # Temporary folder to refresh SDK with TypeSpec. 38 | TempTypeSpecFiles/ 39 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/set-daily-docs-branch-name.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: DailyBranchVariableName 3 | type: string 4 | default: TargetBranchName 5 | 6 | steps: 7 | - pwsh: | 8 | $branchName = $env:DAILYDOCSBRANCHNAMEOVERRIDE 9 | if (!$branchName) { 10 | $branchName = "daily/$(Get-Date -Format 'yyyy-MM-dd')-ignore-build" 11 | } 12 | Write-Host "Daily Branch Name: $branchName" 13 | Write-Host "##vso[task.setvariable variable=${{ parameters.DailyBranchVariableName }};]$branchName" 14 | displayName: Set daily docs branch name in $(${{ parameters.DailyBranchVariableName }}) 15 | -------------------------------------------------------------------------------- /sdk/core/azure_core/perf/perf.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | mod mock; 5 | 6 | use azure_core_test::perf::PerfRunner; 7 | 8 | #[tokio::main] 9 | async fn main() -> azure_core::Result<()> { 10 | let runner = PerfRunner::new( 11 | env!("CARGO_MANIFEST_DIR"), 12 | file!(), 13 | vec![ 14 | mock::json::MockJsonTest::test_metadata(), 15 | #[cfg(feature = "xml")] 16 | mock::xml::MockXmlTest::test_metadata(), 17 | ], 18 | )?; 19 | 20 | runner.run().await?; 21 | 22 | Ok(()) 23 | } 24 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/devops-variables-clear.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: Variables 3 | type: object 4 | default: [] 5 | - name: ContinueOnError 6 | type: boolean 7 | default: false 8 | 9 | steps: 10 | - pwsh: | 11 | $rawVariables = @" 12 | ${{ convertToJson(parameters.Variables) }} 13 | "@ 14 | $variables = ConvertFrom-Json $rawVariables -AsHashtable 15 | foreach ($key in $variables.Keys) { 16 | Write-Host "Clearing: $key" 17 | Write-Host "##vso[task.setvariable variable=$key]" 18 | } 19 | continueOnError: ${{ parameters.ContinueOnError }} 20 | displayName: Clear DevOps Variables -------------------------------------------------------------------------------- /sdk/eventhubs/test-resources-post.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # The purpose of this script is to add a small delay between the creation of the live test resources 5 | # and the execution of the live tests. This allows RBAC to replicate and avoids flakiness in the first set 6 | # of live tests that might otherwise start running before RBAC has replicated. 7 | 8 | param ( 9 | [hashtable] $DeploymentOutputs, 10 | [string] $TenantId, 11 | [string] $TestApplicationId 12 | ) 13 | 14 | Write-Verbose "Sleeping for 60 seconds to let RBAC replicate" 15 | Start-Sleep -s 60 16 | -------------------------------------------------------------------------------- /eng/common/docgeneration/templates/matthews/partials/namespace.tmpl.partial: -------------------------------------------------------------------------------- 1 |

{{>partials/title}}

2 |
{{{summary}}}
3 |
{{{conceptual}}}
4 |
{{{remarks}}}
5 | {{#children}} 6 |

{{>partials/namespaceSubtitle}}

7 | 8 | {{#children}} 9 | 10 | 14 | 15 | {{/children}} 16 |
11 |

12 |

{{{summary}}}

13 |
17 | {{/children}} 18 | -------------------------------------------------------------------------------- /sdk/cosmos/ci.yml: -------------------------------------------------------------------------------- 1 | # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. 2 | 3 | trigger: 4 | branches: 5 | include: 6 | - main 7 | - hotfix/* 8 | - release/* 9 | paths: 10 | include: 11 | - sdk/cosmos/ 12 | 13 | parameters: 14 | - name: release_azure_data_cosmos 15 | displayName: azure_data_cosmos 16 | type: boolean 17 | default: false 18 | 19 | extends: 20 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 21 | parameters: 22 | ServiceDirectory: cosmos 23 | Artifacts: 24 | - name: azure_data_cosmos 25 | releaseInBatch: ${{ parameters.release_azure_data_cosmos }} 26 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/generated/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod append_blob_client; 7 | mod blob_client; 8 | mod blob_container_client; 9 | mod blob_service_client; 10 | mod block_blob_client; 11 | mod page_blob_client; 12 | pub use append_blob_client::*; 13 | pub use blob_client::*; 14 | pub use blob_container_client::*; 15 | pub use blob_service_client::*; 16 | pub use block_blob_client::*; 17 | pub use page_blob_client::*; 18 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/verify-changelogs.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: PackagePropertiesFolder 3 | type: string 4 | - name: Condition 5 | type: string 6 | default: succeeded() 7 | - name: ForRelease 8 | type: boolean 9 | default: false 10 | 11 | steps: 12 | - task: Powershell@2 13 | inputs: 14 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Verify-ChangeLogs.ps1 15 | arguments: > 16 | -PackagePropertiesFolder '${{ parameters.PackagePropertiesFolder }}' 17 | -ForRelease $${{ parameters.ForRelease }} 18 | pwsh: true 19 | displayName: Verify ChangeLogEntries 20 | condition: ${{ parameters.Condition }} 21 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_security_keyvault_test" 3 | version = "0.1.0" 4 | description = "Common utilities for Key Vault tests" 5 | readme = "README.md" 6 | authors.workspace = true 7 | edition.workspace = true 8 | license.workspace = true 9 | repository.workspace = true 10 | rust-version.workspace = true 11 | homepage = "https://github.com/azure/azure-sdk-for-rust" 12 | keywords = ["sdk", "azure", "rest", "cloud", "keyvault", "security", "test"] 13 | categories = ["development-tools"] 14 | publish = false 15 | 16 | [dependencies] 17 | tokio = { workspace = true, features = ["rt"] } 18 | 19 | [lints] 20 | workspace = true 21 | -------------------------------------------------------------------------------- /sdk/identity/azure_identity/tests/tools/deployed_live_test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "deployed_live_test" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [workspace] 8 | 9 | [dependencies] 10 | azure_identity = { path = "../../../" } 11 | azure_storage_blob = { path = "../../../../../storage/azure_storage_blob" } 12 | azure_core = { path = "../../../../../core/azure_core" } 13 | openssl = { version = "0.10", features = ["vendored"]} 14 | tokio = { version = "1.0", features = ["full"] } 15 | url = "2.5" 16 | axum = { version = "0.8", default-features = false, features = ["http1", "tokio", "query"] } 17 | serde = { version = "1.0", features = ["derive"] } 18 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use std::ffi::{c_char, CStr}; 5 | 6 | #[macro_use] 7 | mod macros; 8 | 9 | /// cbindgen:ignore 10 | #[no_mangle] // Necessary to prevent the compiler from stripping it when optimizing 11 | pub static BUILD_IDENTIFIER: &CStr = c_str!(env!("BUILD_IDENTIFIER")); 12 | 13 | const VERSION: &CStr = c_str!(env!("CARGO_PKG_VERSION")); 14 | 15 | /// Returns a constant C string containing the version of the Cosmos Client library. 16 | #[no_mangle] 17 | pub extern "C" fn cosmosclient_version() -> *const c_char { 18 | VERSION.as_ptr() 19 | } 20 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/options/user_agent.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | /// Policy options to telemeter the `User-Agent` header. 5 | #[derive(Clone, Debug, Default)] 6 | pub struct UserAgentOptions { 7 | /// Set the application ID in the `User-Agent` header that can be telemetered. 8 | /// 9 | /// # Panics 10 | /// 11 | /// Panics if [`UserAgentOptions::application_id`] is greater than 24 characters. 12 | /// See [guidelines](https://azure.github.io/azure-sdk/general_azurecore.html#azurecore-http-telemetry-appid-length) for details. 13 | pub application_id: Option, 14 | } 15 | -------------------------------------------------------------------------------- /sdk/core/typespec/src/json.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! JSON serialization functions. 5 | use crate::error::Result; 6 | use bytes::Bytes; 7 | use serde::{de::DeserializeOwned, Serialize}; 8 | 9 | /// Serialize a type to JSON. 10 | pub fn to_json(value: &T) -> Result 11 | where 12 | T: ?Sized + Serialize, 13 | { 14 | Ok(Bytes::from(serde_json::to_vec(value)?)) 15 | } 16 | 17 | /// Reads the JSON from bytes. 18 | pub fn from_json(body: S) -> Result 19 | where 20 | S: AsRef<[u8]>, 21 | T: DeserializeOwned, 22 | { 23 | serde_json::from_slice(body.as_ref()).map_err(Into::into) 24 | } 25 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/retain-run.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: DaysValid 3 | default: 731 4 | type: number 5 | 6 | steps: 7 | - task: PowerShell@2 8 | displayName: Retain pipeline run 9 | env: 10 | SYSTEM_ACCESSTOKEN: $(System.AccessToken) 11 | inputs: 12 | pwsh: true 13 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Add-RetentionLease.ps1 14 | arguments: > 15 | -Organization azure-sdk 16 | -Project $(System.TeamProject) 17 | -DefinitionId $(System.DefinitionId) 18 | -RunId $(Build.BuildId) 19 | -DaysValid ${{ parameters.DaysValid }} 20 | -AccessToken $env:SYSTEM_ACCESSTOKEN 21 | -Debug -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_data_cosmos_native" 3 | publish = false 4 | description = "The Cosmos Native Client is a C library, written in Rust but exporting a C-compatible API, that provides a full SDK for Azure Cosmos DB." 5 | version = "0.27.0" 6 | authors.workspace = true 7 | edition.workspace = true 8 | license.workspace = true 9 | repository.workspace = true 10 | rust-version.workspace = true 11 | 12 | [lib] 13 | name = "azurecosmos" 14 | crate-type = ["cdylib", "staticlib"] 15 | 16 | [dependencies] 17 | azure_data_cosmos = { path = "../azure_data_cosmos" } 18 | 19 | [build-dependencies] 20 | cbindgen = "0.29.0" 21 | 22 | [lints] 23 | workspace = true 24 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/devops-variables-set.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: Variables 3 | type: object 4 | default: [] 5 | - name: ContinueOnError 6 | type: boolean 7 | default: false 8 | 9 | steps: 10 | - pwsh: | 11 | $rawVariables = @" 12 | ${{ convertToJson(parameters.Variables) }} 13 | "@ 14 | $variables = ConvertFrom-Json $rawVariables -AsHashtable 15 | foreach ($key in $variables.Keys) { 16 | $value = $variables[$key] 17 | Write-Host "Setting: $key = $value" 18 | Write-Host "##vso[task.setvariable variable=$key]$value" 19 | } 20 | continueOnError: ${{ parameters.ContinueOnError }} 21 | displayName: Set DevOps Variables -------------------------------------------------------------------------------- /.config/1espt/PipelineAutobaseliningConfig.yml: -------------------------------------------------------------------------------- 1 | ## DO NOT MODIFY THIS FILE MANUALLY. This is part of auto-baselining from 1ES Pipeline Templates. Go to [https://aka.ms/1espt-autobaselining] for more details. 2 | 3 | pipelines: 4 | '*': 5 | mainPipelineId: 7470 6 | retail: 7 | source: 8 | credscan: 9 | lastModifiedDate: 2025-03-11 10 | psscriptanalyzer: 11 | lastModifiedDate: 2025-03-11 12 | armory: 13 | lastModifiedDate: 2025-03-11 14 | binary: 15 | credscan: 16 | lastModifiedDate: 2025-03-21 17 | binskim: 18 | lastModifiedDate: 2025-03-21 19 | spotbugs: 20 | lastModifiedDate: 2025-03-21 21 | -------------------------------------------------------------------------------- /deny.toml: -------------------------------------------------------------------------------- 1 | [graph] 2 | all-features = true 3 | exclude-dev = true 4 | 5 | [advisories] 6 | git-fetch-with-cli = true 7 | ignore = [] 8 | 9 | [licenses] 10 | allow = [ 11 | "Apache-2.0", 12 | "BSD-3-Clause", 13 | "BSL-1.0", 14 | "ISC", 15 | "MIT", 16 | "MPL-2.0", 17 | # "OpenSSL", 18 | "Unicode-3.0", 19 | "Zlib", 20 | ] 21 | 22 | [[licenses.clarify]] 23 | name = "ring" 24 | expression = "MIT AND ISC AND OpenSSL" 25 | license-files = [ 26 | { path = "LICENSE", hash = 0xbd0eed23 }, 27 | ] 28 | 29 | [bans] 30 | multiple-versions = "allow" 31 | wildcards = "deny" 32 | allow-wildcard-paths = true 33 | deny = [ 34 | "ring", 35 | "smol", 36 | ] 37 | 38 | [sources] 39 | unknown-registry = "deny" 40 | unknown-git = "deny" 41 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/install-pipeline-generation.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | ToolPath: $(Pipeline.Workspace)/pipeline-generator 3 | 4 | steps: 5 | - script: > 6 | mkdir pipeline-generator 7 | workingDirectory: $(Pipeline.Workspace) 8 | displayName: Setup working directory for pipeline generator. 9 | - script: > 10 | dotnet tool install 11 | Azure.Sdk.Tools.PipelineGenerator 12 | --version 1.1.0-dev.20250206.1 13 | --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json 14 | --tool-path ${{parameters.ToolPath}} 15 | workingDirectory: $(Pipeline.Workspace)/pipeline-generator 16 | displayName: 'Install pipeline generator tool' 17 | -------------------------------------------------------------------------------- /sdk/servicebus/ci.yml: -------------------------------------------------------------------------------- 1 | # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. 2 | 3 | trigger: 4 | branches: 5 | include: 6 | - main 7 | - feature/* 8 | - release/* 9 | - hotfix/* 10 | paths: 11 | include: 12 | - sdk/servicebus/ 13 | 14 | parameters: 15 | - name: release_azure_messaging_servicebus 16 | displayName: azure_messaging_servicebus 17 | type: boolean 18 | default: false 19 | 20 | extends: 21 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 22 | parameters: 23 | ServiceDirectory: servicebus 24 | Artifacts: 25 | - name: azure_messaging_servicebus 26 | releaseInBatch: ${{ parameters.release_azure_messaging_servicebus }} 27 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/cosmos-emulator.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | EmulatorInstallPath: "$(Agent.HomeDirectory)/../../Program Files/Azure Cosmos DB Emulator/Microsoft.Azure.Cosmos.Emulator.exe" 3 | EmulatorMsiUrl: "https://aka.ms/cosmosdb-emulator" 4 | StartParameters: '' 5 | 6 | steps: 7 | - task: Powershell@2 8 | inputs: 9 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Cosmos-Emulator.ps1 10 | arguments: > 11 | -EmulatorMsiUrl "${{ parameters.EmulatorMsiUrl }}" 12 | -StartParameters "${{ parameters.StartParameters }}" 13 | -Emulator "${{ parameters.EmulatorInstallPath }}" 14 | -Stage "Launch" 15 | pwsh: true 16 | displayName: Launch Public Cosmos DB Emulator 17 | -------------------------------------------------------------------------------- /eng/pipelines/templates/variables/image.yml: -------------------------------------------------------------------------------- 1 | # Default pool image selection. Set as variable so we can override at pipeline level 2 | 3 | variables: 4 | - name: LINUXPOOL 5 | value: azsdk-pool 6 | - name: WINDOWSPOOL 7 | value: azsdk-pool 8 | - name: MACPOOL 9 | value: Azure Pipelines 10 | 11 | - name: LINUXVMIMAGE 12 | value: ubuntu-22.04 13 | - name: LINUXNEXTVMIMAGE 14 | value: ubuntu-24.04 15 | - name: WINDOWSVMIMAGE 16 | value: windows-2022 17 | - name: MACVMIMAGE 18 | value: macos-latest 19 | 20 | # Values required for pool.os field in 1es pipeline templates 21 | - name: LINUXOS 22 | value: linux 23 | - name: WINDOWSOS 24 | value: windows 25 | - name: MACOS 26 | value: macOS 27 | -------------------------------------------------------------------------------- /eng/common/scripts/Add-IssueLabels.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess = $true)] 2 | param( 3 | [Parameter(Mandatory = $true)] 4 | [string]$RepoOwner, 5 | 6 | [Parameter(Mandatory = $true)] 7 | [string]$RepoName, 8 | 9 | [Parameter(Mandatory = $true)] 10 | [string]$IssueNumber, 11 | 12 | [Parameter(Mandatory = $true)] 13 | [string]$Labels, 14 | 15 | [Parameter(Mandatory = $true)] 16 | [string]$AuthToken 17 | ) 18 | 19 | . (Join-Path $PSScriptRoot common.ps1) 20 | 21 | try { 22 | Add-GithubIssueLabels -RepoOwner $RepoOwner -RepoName $RepoName ` 23 | -IssueNumber $IssueNumber -Labels $Labels -AuthToken $AuthToken 24 | } 25 | catch { 26 | LogError "Add-GithubIssueLabels failed with exception:`n$_" 27 | exit 1 28 | } -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/c_tests/version.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include 6 | #include "../include/cosmosclient.h" 7 | 8 | int main() { 9 | const char *version = cosmosclient_version(); 10 | const char *header_version = COSMOSCLIENT_H_VERSION; 11 | printf("Cosmos Client Version: %s\n", version); 12 | printf("Header Version: %s\n", header_version); 13 | if (!strcmp(version, header_version)) { 14 | printf("Version match successful.\n"); 15 | return 0; 16 | } else { 17 | printf("Version mismatch: %s != %s\n", version, header_version); 18 | return 1; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /eng/common/TestResources/clouds/AzureChinaCloud.json: -------------------------------------------------------------------------------- 1 | { 2 | "azConfigEndpointSuffix": ".azconfig.azure.cn", 3 | "azureAuthorityHost": "https://login.chinacloudapi.cn/", 4 | "cognitiveServicesEndpointSuffix": ".cognitiveservices.azure.cn", 5 | "containerRegistryEndpointSuffix": ".azurecr.cn", 6 | "cosmosEndpointSuffix": "cosmos.azure.cn", 7 | "enableStorageVersioning": false, 8 | "keyVaultDomainSuffix": ".vault.azure.cn", 9 | "keyVaultEndpointSuffix": ".vault.azure.cn", 10 | "keyVaultSku": "standard", 11 | "searchEndpointSuffix": "search.azure.cn", 12 | "serviceBusEndpointSuffix": ".servicebus.chinacloudapi.cn", 13 | "storageEndpointSuffix": "core.chinacloudapi.cn", 14 | "textAnalyticsSku": "S" 15 | } 16 | -------------------------------------------------------------------------------- /eng/common/scripts/Add-IssueComment.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess = $true)] 2 | param( 3 | [Parameter(Mandatory = $true)] 4 | [string]$RepoOwner, 5 | 6 | [Parameter(Mandatory = $true)] 7 | [string]$RepoName, 8 | 9 | [Parameter(Mandatory = $true)] 10 | [string]$IssueNumber, 11 | 12 | [Parameter(Mandatory = $true)] 13 | [string]$Comment, 14 | 15 | [Parameter(Mandatory = $true)] 16 | [string]$AuthToken 17 | ) 18 | 19 | . (Join-Path $PSScriptRoot common.ps1) 20 | 21 | try { 22 | Add-GithubIssueComment -RepoOwner $RepoOwner -RepoName $RepoName ` 23 | -IssueNumber $IssueNumber -Comment $Comment -AuthToken $AuthToken 24 | } 25 | catch { 26 | LogError "Add-GithubIssueComment failed with exception:`n$_" 27 | exit 1 28 | } -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/tests/common/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | static INIT_LOGGING: std::sync::Once = std::sync::Once::new(); 5 | 6 | pub fn setup() { 7 | INIT_LOGGING.call_once(|| { 8 | println!("Setting up test logger..."); 9 | 10 | use tracing_subscriber::{fmt::format::FmtSpan, EnvFilter}; 11 | tracing_subscriber::fmt() 12 | .with_env_filter(EnvFilter::from_default_env()) 13 | .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE) 14 | .with_ansi(std::env::var("NO_COLOR").map_or(true, |v| v.is_empty())) 15 | .with_writer(std::io::stderr) 16 | .init(); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /eng/common/docgeneration/templates/matthews/partials/affix.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{^_disableContribution}} 2 |
3 | {{#docurl}} 4 | 5 | {{/docurl}} 6 | {{#sourceurl}} 7 | 8 | {{/sourceurl}} 9 |
10 | {{/_disableContribution}} 11 | 12 | 18 | -------------------------------------------------------------------------------- /sdk/identity/azure_identity/src/process/tokio.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use super::Executor; 5 | use async_trait::async_trait; 6 | use std::{ffi::OsStr, io, process::Output}; 7 | 8 | /// An [`Executor`] using [`tokio::process::Command`]. 9 | #[derive(Debug)] 10 | pub struct TokioExecutor; 11 | 12 | #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] 13 | #[cfg_attr(not(target_arch = "wasm32"), async_trait)] 14 | impl Executor for TokioExecutor { 15 | async fn run(&self, program: &OsStr, args: &[&OsStr]) -> io::Result { 16 | ::tokio::process::Command::new(program) 17 | .args(args) 18 | .output() 19 | .await 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | /// Clients used to communicate with the service. 7 | pub mod clients; 8 | /// Contains all the data structures and types used by the client library. 9 | pub mod models; 10 | pub use clients::{ 11 | AppendBlobClient, AppendBlobClientOptions, BlobClient, BlobClientOptions, BlobContainerClient, 12 | BlobContainerClientOptions, BlobServiceClient, BlobServiceClientOptions, BlockBlobClient, 13 | BlockBlobClientOptions, PageBlobClient, PageBlobClientOptions, 14 | }; 15 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/validate-filename.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | WorkingDirectory: '$(System.DefaultWorkingDirectory)' 3 | steps: 4 | - pwsh: | 5 | $differByCaseFiles = git ls-files | Group-Object | Where-Object { $_.Count -gt 1 } 6 | 7 | if ($differByCaseFiles) 8 | { 9 | foreach ($fileGroup in $differByCaseFiles) { 10 | Write-Host "Duplicated Files: " 11 | Write-Host "[ $($fileGroup.Group) ]" 12 | } 13 | Write-Host "Do NOT name the files which only differ in case. Please check above files." 14 | exit 1 15 | } 16 | Write-Host "There are no file names that only differ in case." 17 | displayName: Check file case duplicates 18 | workingDirectory: ${{ parameters.WorkingDirectory }} -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/mark-release-completion.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | ConfigFileDir: '' 3 | PackageArtifactName: '' 4 | SourceRootPath: $(Build.SourcesDirectory) 5 | 6 | steps: 7 | - task: AzureCLI@2 8 | inputs: 9 | azureSubscription: opensource-api-connection 10 | scriptType: pscore 11 | scriptLocation: scriptPath 12 | scriptPath: ${{ parameters.SourceRootPath }}/eng/common/scripts/Mark-ReleasePlanCompletion.ps1 13 | arguments: -PackageInfoFilePath '${{ parameters.ConfigFileDir }}/${{ parameters.PackageArtifactName }}.json' 14 | workingDirectory: $(Pipeline.Workspace) 15 | displayName: Mark package as released 16 | continueOnError: true 17 | condition: and(succeeded(), ne(variables['Skip.MarkReleaseCompletion'], 'true')) -------------------------------------------------------------------------------- /eng/common/TestResources/clouds/AzureUSGovernment.json: -------------------------------------------------------------------------------- 1 | { 2 | "azConfigEndpointSuffix": ".azconfig.azure.us", 3 | "azureAuthorityHost": "https://login.microsoftonline.us/", 4 | "cognitiveServicesEndpointSuffix": ".cognitiveservices.azure.us", 5 | "containerRegistryEndpointSuffix": ".azurecr.us", 6 | "cosmosEndpointSuffix": "cosmos.azure.us", 7 | "enableStorageVersioning": false, 8 | "formRecognizerLocation": "usgovvirginia", 9 | "keyVaultDomainSuffix": ".vault.usgovcloudapi.net", 10 | "keyVaultEndpointSuffix": ".vault.usgovcloudapi.net", 11 | "keyVaultSku": "premium", 12 | "searchEndpointSuffix": "search.azure.us", 13 | "serviceBusEndpointSuffix": ".servicebus.usgovcloudapi.net", 14 | "storageEndpointSuffix": "core.usgovcloudapi.net" 15 | } 16 | -------------------------------------------------------------------------------- /eng/common/scripts/Get-PullRequestCreator.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [Parameter(Mandatory = $true)] 3 | [string]$RepoOwner, 4 | 5 | [Parameter(Mandatory = $true)] 6 | [string]$RepoName, 7 | 8 | [Parameter(Mandatory = $true)] 9 | $PullRequestNumber, 10 | 11 | [Parameter(Mandatory = $true)] 12 | [string]$AuthToken 13 | ) 14 | 15 | . (Join-Path $PSScriptRoot common.ps1) 16 | 17 | try 18 | { 19 | $pullRequest = Get-GithubPullRequest -RepoOwner $RepoOwner -RepoName $RepoName ` 20 | -PullRequestNumber $PullRequestNumber -AuthToken $AuthToken 21 | Write-Host "##vso[task.setvariable variable=System.PullRequest.Creator;]$($pullRequest.user.login)" 22 | } 23 | catch 24 | { 25 | Write-Error "Get-PullRequest failed with exception:`n$_" 26 | exit 1 27 | } 28 | 29 | -------------------------------------------------------------------------------- /eng/common/scripts/Verify-AgentOS.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [Parameter(Mandatory = $true)] 3 | [ValidateNotNullOrEmpty()] 4 | [string] $AgentImage 5 | ) 6 | 7 | function Throw-InvalidOperatingSystem { 8 | throw "Invalid operating system detected. Operating system was: $([System.Runtime.InteropServices.RuntimeInformation]::OSDescription), expected image was: $AgentImage" 9 | } 10 | 11 | if ($IsWindows -and $AgentImage -match "windows|win|MMS\d{4}") { 12 | $osName = "Windows" 13 | } elseif ($IsLinux -and $AgentImage -match "ubuntu|linux") { 14 | $osName = "Linux" 15 | } elseif ($IsMacOs -and $AgentImage -match "macos|macOS") { 16 | $osName = "macOS" 17 | } else { 18 | Throw-InvalidOperatingSystem 19 | } 20 | 21 | Write-Host "##vso[task.setvariable variable=OSName]$osName" 22 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/cache-ps-modules.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - pwsh: | 3 | . ./eng/common/scripts/Helpers/PSModule-Helpers.ps1 4 | Write-Host "##vso[task.setvariable variable=CachedPSModulePath]$global:CurrentUserModulePath" 5 | displayName: Set PS Modules Cache Directory 6 | # Containers should bake modules into the image to save on pipeline time 7 | condition: and(succeeded(), eq(variables['Container'], '')) 8 | - task: Cache@2 9 | inputs: 10 | key: 'PSModulePath | $(CacheSalt) | $(Agent.OS) | $(Build.SourcesDirectory)/eng/common/scripts/Import-AzModules.ps1' 11 | path: $(CachedPSModulePath) 12 | displayName: Cache PS Modules 13 | # Containers should bake modules into the image to save on pipeline time 14 | condition: and(succeeded(), eq(variables['Container'], '')) 15 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "azure-pipelines.1ESPipelineTemplatesSchemaFile": true, 3 | "cSpell.enabled": true, 4 | "editor.formatOnSave": true, 5 | "github.copilot.chat.commitMessageGeneration.instructions": [ 6 | { 7 | "file": "doc/git-commit-instructions.md" 8 | } 9 | ], 10 | "github.copilot.chat.pullRequestDescriptionGeneration.instructions": [ 11 | { 12 | "file": "doc/github-pullrequest-instructions.md" 13 | } 14 | ], 15 | "markdownlint.config": { 16 | "MD024": false, 17 | "MD046": { 18 | "style": "consistent" 19 | } 20 | }, 21 | "rust-analyzer.cargo.features": "all", 22 | "rust-analyzer.check.command": "clippy", 23 | "yaml.format.printWidth": 240, 24 | "[powershell]": { 25 | "editor.defaultFormatter": "ms-vscode.powershell", 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /eng/common/instructions/copilot/sdk-release.instructions.md: -------------------------------------------------------------------------------- 1 | # SDK release 2 | 3 | There are two tools to help with SDK releases: 4 | - Check SDK release readiness 5 | - Release SDK 6 | 7 | ## Check SDK Release Readiness 8 | Run `CheckPackageReleaseReadiness` to verify if the package is ready for release. This tool checks: 9 | - API review status 10 | - Change log status 11 | - Package name approval(If package is new and releasing a preview version) 12 | - Release date is set in release tracker 13 | 14 | ## Release SDK 15 | Run `ReleasePackage` to release the package. This tool requires package name and language as inputs. It will: 16 | - Check if the package is ready for release 17 | - Identify the release pipeline 18 | - Trigger the release pipeline. 19 | User needs to approve the release stage in the pipeline after it is triggered. -------------------------------------------------------------------------------- /sdk/core/typespec_macros/tests/data/safe-debug-tests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | # This package is INTENTIONALLY omitted from the workspace because it contains files that do not compile (as part of testing compilation error reporting) 3 | # So we create a workspace node to tell cargo this is the root of a workspace 4 | 5 | [package] 6 | name = "safe_debug_tests" 7 | version = "0.1.0" 8 | edition = "2021" 9 | publish = false 10 | 11 | [features] 12 | debug = ["typespec_client_core/debug"] 13 | 14 | [dependencies] 15 | litemap = "0.7.4" 16 | typespec_client_core = { path = "../../../../typespec_client_core", features = [ 17 | "derive", 18 | ] } 19 | zerofrom = "0.1.5" 20 | 21 | [dev-dependencies] 22 | rustc_version = "0.4.1" 23 | 24 | [[bench]] 25 | name = "debug" 26 | path = "tests/debug.rs" 27 | required-features = ["debug"] 28 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release History 2 | 3 | ## 0.3.0 (Unreleased) 4 | 5 | ### Features Added 6 | 7 | - Added `continuation_token` to `PagerOptions` for methods that return a `Pager`. 8 | 9 | ### Breaking Changes 10 | 11 | - Removed `Pager::with_continuation_token()` for methods that return a `Pager`. 12 | 13 | ### Bugs Fixed 14 | 15 | ### Other Changes 16 | 17 | ## 0.2.0 (2025-11-11) 18 | 19 | ### Breaking Changes 20 | 21 | - Changed `QueueServiceClientListQueuesOptions::method_options` from `ClientMethodOptions` to `PagerOptions` 22 | - Renamed `Response::into_body(self) -> Result>` to `into_model(self) -> Result>`. `into_body(self)` now returns a `ResponseBody`. 23 | 24 | ## 0.1.0 (2025-10-15) 25 | 26 | ### Features Added 27 | 28 | - Initial supported release. 29 | -------------------------------------------------------------------------------- /eng/common/scripts/Delete-RemoteTag.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | $Repository, 3 | $Tag, 4 | $AuthToken 5 | ) 6 | 7 | . (Join-Path $PSScriptRoot common.ps1) 8 | 9 | $repositoryParts = $Repository.Split("/") 10 | 11 | if ($repositoryParts.Length -ne 2) 12 | { 13 | LogError "Repository is not a valid format." 14 | } 15 | 16 | $repositoryOwner = $repositoryParts[0] 17 | LogDebug "Repository owner is: $repositoryOwner" 18 | 19 | $repositoryName = $repositoryParts[1] 20 | LogDebug "Reposiory name is: $repositoryName" 21 | 22 | $ref = "tags/$Tag" 23 | LogDebug "Calculated ref is: $ref" 24 | 25 | try 26 | { 27 | Remove-GitHubSourceReferences -RepoOwner $repositoryOwner -RepoName $repositoryName -Ref $ref -AuthToken $AuthToken 28 | } 29 | catch 30 | { 31 | LogError "Remove-GitHubSourceReferences failed with exception:`n$_" 32 | exit 1 33 | } 34 | -------------------------------------------------------------------------------- /eng/common/testproxy/localhost.conf: -------------------------------------------------------------------------------- 1 | [req] 2 | prompt = no 3 | default_bits = 2048 4 | distinguished_name = subject 5 | req_extensions = req_ext 6 | x509_extensions = x509_ext 7 | 8 | [ subject ] 9 | commonName = localhost 10 | 11 | [req_ext] 12 | basicConstraints = critical, CA:true 13 | subjectAltName = @alt_names 14 | 15 | [x509_ext] 16 | basicConstraints = critical, CA:true 17 | keyUsage = critical, keyCertSign, cRLSign, digitalSignature,keyEncipherment 18 | extendedKeyUsage = critical, serverAuth 19 | subjectAltName = critical, @alt_names 20 | 1.3.6.1.4.1.311.84.1.1 = ASN1:UTF8String:ASP.NET Core HTTPS development certificate # Needed to get it imported by dotnet dev-certs 21 | 22 | [alt_names] 23 | DNS.1 = localhost 24 | -------------------------------------------------------------------------------- /sdk/canary/ci.yml: -------------------------------------------------------------------------------- 1 | # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. 2 | 3 | trigger: 4 | branches: 5 | include: 6 | - main 7 | - hotfix/* 8 | - release/* 9 | paths: 10 | include: 11 | - sdk/canary/ 12 | 13 | parameters: 14 | - name: release_azure_canary_core 15 | displayName: azure_canary_core 16 | type: boolean 17 | default: false 18 | - name: release_azure_canary 19 | displayName: azure_canary 20 | type: boolean 21 | default: false 22 | 23 | extends: 24 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 25 | parameters: 26 | ServiceDirectory: canary 27 | Artifacts: 28 | - name: azure_canary 29 | releaseInBatch: ${{ parameters.release_azure_canary }} 30 | - name: azure_canary_core 31 | releaseInBatch: ${{ parameters.release_azure_canary_core }} 32 | -------------------------------------------------------------------------------- /sdk/identity/test-resources-pre.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # IMPORTANT: Do not invoke this file directly. Please instead run eng/common/TestResources/New-TestResources.ps1 from the repository root. 5 | 6 | # cSpell:disable 7 | 8 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] 9 | param ( 10 | [hashtable] $AdditionalParameters = @{}, 11 | 12 | # Captures any arguments from eng/New-TestResources.ps1 not declared here (no parameter errors). 13 | [Parameter(ValueFromRemainingArguments = $true)] 14 | $RemainingArguments 15 | ) 16 | 17 | if (-not (Test-Path "$PSScriptRoot/sshkey.pub")) { 18 | ssh-keygen -t rsa -b 4096 -f "$PSScriptRoot/sshkey" -N '' -C '' 19 | } 20 | $templateFileParameters['sshPubKey'] = Get-Content "$PSScriptRoot/sshkey.pub" 21 | -------------------------------------------------------------------------------- /sdk/servicebus/azure_messaging_servicebus/test-resources-pre.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | 4 | # IMPORTANT: Do not invoke this file directly. Please instead run eng/common/TestResources/New-TestResources.ps1 from the repository root. 5 | 6 | [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] 7 | param ( 8 | [hashtable] $AdditionalParameters = @{}, 9 | 10 | # Captures any arguments from eng/New-TestResources.ps1 not declared here (no parameter errors). 11 | [Parameter(ValueFromRemainingArguments = $true)] 12 | $RemainingArguments 13 | ) 14 | 15 | # This script currently performs no pre-deployment steps. 16 | # Future pre-deployment logic for Service Bus resources can be added here. 17 | 18 | Write-Host "Service Bus pre-deployment: No additional setup required." 19 | -------------------------------------------------------------------------------- /sdk/core/azure_core_macros/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release History 2 | 3 | ## 0.5.0 (Unreleased) 4 | 5 | ### Features Added 6 | 7 | ### Breaking Changes 8 | 9 | ### Bugs Fixed 10 | 11 | ### Other Changes 12 | 13 | ## 0.4.1 (2025-11-09) 14 | 15 | ### Other Changes 16 | 17 | - Increment version for re-release following a fix to publishing. 18 | 19 | ## 0.4.0 (2025-11-07) 20 | 21 | ### Other Changes 22 | 23 | - Updated dependencies. 24 | 25 | ## 0.3.1 (2025-10-06) 26 | 27 | ### Bugs Fixed 28 | 29 | - Fix feature documentation ([#3118](https://github.com/Azure/azure-sdk-for-rust/issues/3118)) 30 | 31 | ## 0.3.0 (2025-10-03) 32 | 33 | ### Other Changes 34 | 35 | - Updated dependencies. 36 | 37 | ## 0.2.0 (2025-09-11) 38 | 39 | ### Other Changes 40 | 41 | - Updated dependencies. 42 | 43 | ## 0.1.0 (2025-08-01) 44 | 45 | ### Features Added 46 | 47 | - Initial release. 48 | -------------------------------------------------------------------------------- /sdk/core/azure_core_macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_core_macros" 3 | version = "0.5.0" 4 | description = "Procedural macros for client libraries built on azure_core." 5 | readme = "README.md" 6 | authors.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | homepage = "https://github.com/azure/azure-sdk-for-rust" 10 | documentation = "https://docs.rs/azure_core" 11 | keywords = ["azure", "cloud", "iot", "rest", "sdk"] 12 | categories = ["development-tools"] 13 | edition.workspace = true 14 | rust-version.workspace = true 15 | 16 | [lib] 17 | proc-macro = true 18 | 19 | [dependencies] 20 | proc-macro2.workspace = true 21 | quote.workspace = true 22 | syn.workspace = true 23 | tracing.workspace = true 24 | 25 | [dev-dependencies] 26 | tokio.workspace = true 27 | tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] } 28 | -------------------------------------------------------------------------------- /sdk/core/azure_core_opentelemetry/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release History 2 | 3 | ## 0.5.0 (Unreleased) 4 | 5 | ### Features Added 6 | 7 | ### Breaking Changes 8 | 9 | ### Bugs Fixed 10 | 11 | ### Other Changes 12 | 13 | ## 0.4.1 (2025-11-09) 14 | 15 | ### Other Changes 16 | 17 | - Increment version for re-release following a fix to publishing. 18 | 19 | ## 0.4.0 (2025-11-07) 20 | 21 | ### Other Changes 22 | 23 | - Updated dependencies. 24 | 25 | ## 0.3.1 (2025-10-06) 26 | 27 | ### Bugs Fixed 28 | 29 | - Fix feature documentation ([#3118](https://github.com/Azure/azure-sdk-for-rust/issues/3118)) 30 | 31 | ## 0.3.0 (2025-10-03) 32 | 33 | ### Other Changes 34 | 35 | - Updated dependencies. 36 | 37 | ## 0.2.0 (2025-09-11) 38 | 39 | ### Other Changes 40 | 41 | - Updated dependencies. 42 | 43 | ## 0.1.0 (2025-08-01) 44 | 45 | ### Features Added 46 | 47 | - Initial release. 48 | -------------------------------------------------------------------------------- /eng/common/docgeneration/templates/matthews/partials/enum.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{>partials/class.header}} 2 | {{#children}} 3 | {{#children}} 4 |

{{name.0.value}}

5 | 6 |
7 |

{{{summary}}}

8 |
9 | {{/children}} 10 | {{/children}} 11 | 12 | {{#extensionMethods.0}} 13 |

{{__global.extensionMethods}}

14 | {{/extensionMethods.0}} 15 | {{#extensionMethods}} 16 |
17 | {{#definition}} 18 | 19 | {{/definition}} 20 | {{^definition}} 21 | 22 | {{/definition}} 23 |
24 | {{/extensionMethods}} 25 | -------------------------------------------------------------------------------- /sdk/core/azure_core_amqp/Test-Cleanup.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Licensed under the MIT License. 3 | # cspell: ignore JOBID 4 | 5 | . "$PSScriptRoot\..\..\..\eng\common\scripts\common.ps1" 6 | 7 | if ($IsMacOS) { 8 | Write-Host "AMQP tests are not supported on macOS. Skipping test setup." 9 | exit 0 10 | } 11 | 12 | 13 | Write-Host "Test Broker output:" 14 | Receive-Job -Id $env:TEST_BROKER_JOBID 15 | 16 | # Check if the test broker job is still running 17 | $job = Get-Job -Id $env:TEST_BROKER_JOBID 18 | if ($job.State -ne "Running") { 19 | Write-Host "Test broker terminated unexpectedly." 20 | exit 1 21 | } 22 | 23 | # Stop the test broker job started in Test-Setup.ps1 24 | Write-Host "Stopping test broker" 25 | Stop-Job -Id $env:TEST_BROKER_JOBID 26 | Remove-Job -Id $env:TEST_BROKER_JOBID 27 | Write-Host "Test broker stopped." 28 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob_test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_storage_blob_test" 3 | version = "0.1.0" 4 | description = "Common utilities for Key Vault tests" 5 | readme = "README.md" 6 | authors.workspace = true 7 | edition.workspace = true 8 | license.workspace = true 9 | repository.workspace = true 10 | rust-version.workspace = true 11 | homepage = "https://github.com/azure/azure-sdk-for-rust" 12 | keywords = ["sdk", "azure", "rest", "cloud", "test"] 13 | categories = ["development-tools"] 14 | publish = false 15 | 16 | [dependencies] 17 | async-trait.workspace = true 18 | azure_core = { workspace = true, features = ["xml"] } 19 | azure_core_test.workspace = true 20 | azure_storage_blob.path = "../azure_storage_blob" 21 | bytes.workspace = true 22 | futures.workspace = true 23 | tokio = { workspace = true, features = ["rt"] } 24 | 25 | [lints] 26 | workspace = true 27 | -------------------------------------------------------------------------------- /eng/common/testproxy/apply-dev-cert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | TMP_PATH=$CERT_FOLDER 3 | PFXFILE=$CERT_FOLDER/dotnet-devcert.pfx 4 | CRTFILE=$CERT_FOLDER/dotnet-devcert.crt 5 | 6 | NSSDB_PATHS=( 7 | "$HOME/.pki/nssdb" 8 | "$HOME/snap/chromium/current/.pki/nssdb" 9 | "$HOME/snap/postman/current/.pki/nssdb" 10 | ) 11 | 12 | function configure_nssdb() { 13 | echo "Configuring nssdb for $1" 14 | certutil -d sql:$1 -D -n dotnet-devcert 15 | certutil -d sql:$1 -A -t "CP,," -n dotnet-devcert -i $CRTFILE 16 | } 17 | 18 | for NSSDB in ${NSSDB_PATHS[@]}; do 19 | if [ -d "$NSSDB" ]; then 20 | configure_nssdb $NSSDB 21 | fi 22 | done 23 | 24 | if [ $(id -u) -ne 0 ]; then 25 | SUDO='sudo' 26 | fi 27 | 28 | $SUDO cp $CRTFILE "/usr/local/share/ca-certificates" 29 | $SUDO update-ca-certificates 30 | 31 | dotnet dev-certs https --clean --import $PFXFILE -p "password" 32 | -------------------------------------------------------------------------------- /eng/common/scripts/Remove-IssueLabel.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(SupportsShouldProcess = $true)] 2 | param( 3 | [Parameter(Mandatory = $true)] 4 | [string]$RepoOwner, 5 | 6 | [Parameter(Mandatory = $true)] 7 | [string]$RepoName, 8 | 9 | [Parameter(Mandatory = $true)] 10 | [string]$IssueNumber, 11 | 12 | [Parameter(Mandatory = $true)] 13 | [string]$LabelName, 14 | 15 | [Parameter(Mandatory = $true)] 16 | [string]$AuthToken 17 | ) 18 | 19 | . (Join-Path $PSScriptRoot common.ps1) 20 | 21 | try { 22 | Remove-GitHubIssueLabel -RepoOwner $RepoOwner -RepoName $RepoName ` 23 | -IssueNumber $IssueNumber -LabelName $LabelName -AuthToken $AuthToken 24 | } 25 | catch { 26 | if ($_.Exception.Response.StatusCode -eq 404) { 27 | LogWarning "Label $LabelName not found on issue" 28 | exit 0 29 | } 30 | LogError "Remove-GithubIssueLabel failed with exception:`n$_" 31 | exit 1 32 | } -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/src/serde.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Internal serialization/deserialization helpers for Azure Cosmos DB SDK. 5 | 6 | /// Module for use with `#[serde(with = "...")]` to serialize/deserialize `url::Url` types by parsing from and converting to strings. 7 | pub mod url { 8 | pub fn serialize(url: &url::Url, serializer: S) -> Result 9 | where 10 | S: serde::Serializer, 11 | { 12 | serializer.serialize_str(url.as_str()) 13 | } 14 | 15 | pub fn deserialize<'de, D>(deserializer: D) -> Result 16 | where 17 | D: serde::Deserializer<'de>, 18 | { 19 | let s: &str = serde::Deserialize::deserialize(deserializer)?; 20 | url::Url::parse(s).map_err(serde::de::Error::custom) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test_macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_core_test_macros" 3 | version = "0.1.0" 4 | description = "Procedural macros for testing client libraries built on azure_core." 5 | readme = "README.md" 6 | authors.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | homepage = "https://github.com/azure/azure-sdk-for-rust" 10 | documentation = "https://docs.rs/azure_core" 11 | keywords = ["azure", "cloud", "iot", "rest", "sdk"] 12 | categories = ["development-tools"] 13 | edition.workspace = true 14 | rust-version.workspace = true 15 | publish = false 16 | 17 | [lib] 18 | proc-macro = true 19 | 20 | [dependencies] 21 | azure_core = { workspace = true, features = ["test"] } 22 | proc-macro2.workspace = true 23 | quote.workspace = true 24 | syn.workspace = true 25 | 26 | [dev-dependencies] 27 | azure_core_test.workspace = true 28 | tokio.workspace = true 29 | -------------------------------------------------------------------------------- /.github/event-processor.config: -------------------------------------------------------------------------------- 1 | { 2 | "InitialIssueTriage": "On", 3 | "ManualIssueTriage": "On", 4 | "ServiceAttention": "On", 5 | "ManualTriageAfterExternalAssignment": "On", 6 | "RequireAttentionForNonMilestone": "On", 7 | "AuthorFeedbackNeeded": "On", 8 | "IssueAddressed": "On", 9 | "IssueAddressedReset": "On", 10 | "AuthorFeedback": "On", 11 | "ReopenIssue": "On", 12 | "DeclineToReopenIssue": "On", 13 | "IssueAddressedCommands": "On", 14 | "PullRequestTriage": "On", 15 | "ResetApprovalsForUntrustedChanges": "On", 16 | "ReopenPullRequest": "On", 17 | "ResetIssueActivity": "On", 18 | "ResetPullRequestActivity": "On", 19 | "CloseStaleIssues": "On", 20 | "CloseStalePullRequests": "On", 21 | "IdentifyStaleIssues": "On", 22 | "IdentifyStalePullRequests": "On", 23 | "CloseAddressedIssues": "On", 24 | "LockClosedIssues": "On", 25 | "EnforceMaxLifeOfIssues": "On" 26 | } 27 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | 7 | pub mod clients; 8 | mod connection_string; 9 | pub mod constants; 10 | mod feed; 11 | mod options; 12 | mod partition_key; 13 | pub(crate) mod pipeline; 14 | pub mod query; 15 | pub(crate) mod resource_context; 16 | pub(crate) mod utils; 17 | 18 | pub mod models; 19 | 20 | #[doc(inline)] 21 | pub use clients::CosmosClient; 22 | 23 | pub use connection_string::*; 24 | pub use options::*; 25 | pub use partition_key::*; 26 | pub use query::Query; 27 | 28 | pub use feed::{FeedPage, FeedPager}; 29 | mod cosmos_request; 30 | mod handler; 31 | mod operation_context; 32 | pub mod regions; 33 | mod request_context; 34 | mod retry_policies; 35 | pub mod routing; 36 | mod serde; 37 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/sleep.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Sleep functions. 5 | 6 | use crate::{async_runtime::get_async_runtime, time::Duration}; 7 | 8 | /// Sleeps for the specified duration using the configured async runtime. 9 | /// 10 | /// # Arguments 11 | /// * `duration` - The duration to sleep for. 12 | /// 13 | /// # Returns 14 | /// A future that resolves when the sleep duration has elapsed. 15 | /// 16 | /// # Examples 17 | /// 18 | /// ``` no_run 19 | /// use typespec_client_core::{sleep, time::Duration}; 20 | /// 21 | /// # #[tokio::main] 22 | /// # async fn main() { 23 | /// // Sleep for 1 second 24 | /// sleep(Duration::seconds(1)).await; 25 | /// println!("Slept for 1 second"); 26 | /// # } 27 | /// ``` 28 | pub async fn sleep(duration: Duration) { 29 | get_async_runtime().sleep(duration).await 30 | } 31 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/set-default-branch.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | WorkingDirectory: '$(System.DefaultWorkingDirectory)' 3 | RemoteRepo: 'origin' 4 | DefaultBranchVariableName: DefaultBranch 5 | Condition: 'succeeded()' 6 | steps: 7 | - pwsh: | 8 | $setDefaultBranch = (git remote show ${{ parameters.RemoteRepo }} | Out-String) -replace "(?ms).*HEAD branch: (\w+).*", '$1' 9 | if ($LASTEXITCODE -ne 0) { 10 | Write-Host "Not able to fetch the default branch from git command. Set to main." 11 | $setDefaultBranch = 'main' 12 | } 13 | Write-Host "Setting ${{ parameters.DefaultBranchVariableName }}=$setDefaultBranch" 14 | Write-Host "##vso[task.setvariable variable=${{ parameters.DefaultBranchVariableName }}]$setDefaultBranch" 15 | displayName: "Setup Default Branch" 16 | workingDirectory: ${{ parameters.workingDirectory }} 17 | condition: ${{ parameters.Condition }} 18 | ignoreLASTEXITCODE: true 19 | -------------------------------------------------------------------------------- /eng/common/scripts/Verify-ChangeLog.ps1: -------------------------------------------------------------------------------- 1 | # Wrapper Script for ChangeLog Verification 2 | [CmdletBinding()] 3 | param ( 4 | [String]$ChangeLogLocation, 5 | [String]$VersionString, 6 | [string]$PackageName, 7 | [string]$ServiceDirectory, 8 | [boolean]$ForRelease = $False 9 | ) 10 | Set-StrictMode -Version 3 11 | 12 | . (Join-Path $PSScriptRoot common.ps1) 13 | 14 | $validChangeLog = $false 15 | if ($ChangeLogLocation -and $VersionString) 16 | { 17 | $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease 18 | } 19 | else 20 | { 21 | $PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory 22 | $validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.ChangeLogPath -VersionString $PackageProp.Version -ForRelease $ForRelease 23 | } 24 | 25 | if (!$validChangeLog) 26 | { 27 | exit 1 28 | } 29 | 30 | exit 0 -------------------------------------------------------------------------------- /sdk/identity/azure_identity/src/process/standard.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use super::Executor; 5 | use futures::channel::oneshot; 6 | use std::{ffi::OsStr, io, process::Output, thread}; 7 | 8 | /// An [`Executor`] using [`std::process::Command`] from [`std::thread::spawn()`]. 9 | #[derive(Debug)] 10 | pub struct StdExecutor; 11 | 12 | #[async_trait::async_trait] 13 | impl Executor for StdExecutor { 14 | async fn run(&self, program: &OsStr, args: &[&OsStr]) -> io::Result { 15 | let (tx, rx) = oneshot::channel(); 16 | let mut cmd = std::process::Command::new(program); 17 | cmd.args(args); 18 | thread::spawn(move || { 19 | let output = cmd.output(); 20 | tx.send(output) 21 | }); 22 | let output = rx.await.map_err(io::Error::other)??; 23 | Ok(output) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.github/instructions/changelog.instructions.md: -------------------------------------------------------------------------------- 1 | --- 2 | applyTo: "**/CHANGELOG.md" 3 | --- 4 | 5 | - Summarize each change to public APIs in a single line for clarity and brevity. 6 | - If there are no changes to public APIs, do not make any changes to `CHANGELOG.md` files. 7 | - Place each change under the appropriate existing category header (e.g., "Features Added", "Breaking Changes", "Bugs Fixed", "Other Changes", etc.) found under the top-level `##` section. 8 | - Do not create new category headers; use only those already present in the file. 9 | - Ensure all entries are concise, accurate, and relevant to the release. 10 | - Follow the existing formatting and style conventions of the file. 11 | - Changes in `sdk/core/typespec/CHANGELOG.md` should be reflected in `sdk/core/typespec_client_core/CHANGELOG.md`. 12 | - Changes in `sdk/core/typespec_client_core/CHANGELOG.md` should be reflected in `sdk/core/azure_core/CHANGELOG.md`. 13 | -------------------------------------------------------------------------------- /.github/workflows/post-apiview.yml: -------------------------------------------------------------------------------- 1 | name: After APIView 2 | 3 | on: 4 | check_run: 5 | types: [completed] 6 | 7 | permissions: 8 | pull-requests: write 9 | contents: read 10 | 11 | jobs: 12 | post-apiview: 13 | name: After APIView 14 | runs-on: ubuntu-24.04 15 | if: | 16 | github.event.check_run.check_suite.app.name == 'Azure Pipelines' && ( 17 | contains(github.event.check_run.name, 'Build Build') || 18 | contains(github.event.check_run.name, 'Build Analyze') ) 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v4 22 | with: 23 | sparse-checkout: 'eng/common' 24 | 25 | - name: Create APIView Comment on PR 26 | run: | 27 | . "eng/common/scripts/Helpers/ApiView-Helpers.ps1" 28 | Set-ApiViewCommentForRelatedIssues -HeadCommitish ${{ github.event.check_run.head_sha }} -AuthToken ${{ secrets.GITHUB_TOKEN }} 29 | shell: pwsh 30 | -------------------------------------------------------------------------------- /eng/tools/generate_api_report/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use serde::Deserialize; 5 | use std::{fs, path::Path}; 6 | 7 | fn main() { 8 | let toolchain_file = Path::new(env!("CARGO_MANIFEST_DIR")).join("rust-toolchain.toml"); 9 | let toolchain_content = 10 | fs::read_to_string(toolchain_file).expect("read rust-toolchain.toml from crate root"); 11 | let manifest: Manifest = 12 | toml::from_str(&toolchain_content).expect("deserialize rust-toolchain.toml"); 13 | println!( 14 | "cargo::rustc-env=TOOLCHAIN_CHANNEL={}", 15 | manifest.toolchain.channel 16 | ); 17 | println!("cargo::rerun-if-changed=rust-toolchain.toml"); 18 | } 19 | 20 | #[derive(Debug, Deserialize)] 21 | struct Manifest { 22 | toolchain: Toolchain, 23 | } 24 | 25 | #[derive(Debug, Deserialize)] 26 | struct Toolchain { 27 | channel: String, 28 | } 29 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/verify-restapi-spec-location.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: ServiceDirectory 3 | type: string 4 | default: '' 5 | - name: PackageName 6 | type: string 7 | default: '' 8 | - name: ArtifactLocation 9 | type: string 10 | default: '' 11 | 12 | steps: 13 | - task: Powershell@2 14 | inputs: 15 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Verify-RestApiSpecLocation.ps1 16 | arguments: > 17 | -ServiceDirectory "${{ parameters.ServiceDirectory }}" 18 | -PackageName "${{ parameters.PackageName }}" 19 | -ArtifactLocation: "${{ parameters.ArtifactLocation }}" 20 | pwsh: true 21 | workingDirectory: $(Pipeline.Workspace) 22 | displayName: Verify REST API spec location for "${{ parameters.PackageName }}" 23 | env: 24 | GH_TOKEN: $(azuresdk-github-pat) 25 | condition: and(succeededOrFailed(), ne(variables['Skip.Verify-RestApiSpecLocation'], 'true')) 26 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/clients/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | mod append_blob_client; 7 | mod blob_client; 8 | mod blob_container_client; 9 | mod blob_service_client; 10 | mod block_blob_client; 11 | mod page_blob_client; 12 | 13 | pub use append_blob_client::AppendBlobClient; 14 | pub use blob_client::BlobClient; 15 | pub use blob_container_client::BlobContainerClient; 16 | pub use blob_service_client::BlobServiceClient; 17 | pub use block_blob_client::BlockBlobClient; 18 | pub use page_blob_client::PageBlobClient; 19 | 20 | pub use crate::generated::clients::{ 21 | AppendBlobClientOptions, BlobClientOptions, BlobContainerClientOptions, 22 | BlobServiceClientOptions, BlockBlobClientOptions, PageBlobClientOptions, 23 | }; 24 | -------------------------------------------------------------------------------- /sdk/core/typespec_macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "typespec_macros" 3 | version = "0.10.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | description = "Procedural macros for client libraries built on typespec." 7 | homepage = "https://typespec.io" 8 | repository.workspace = true 9 | license.workspace = true 10 | categories = ["compilers", "development-tools"] 11 | keywords = ["typespec"] 12 | 13 | [lib] 14 | proc-macro = true 15 | 16 | [features] 17 | debug = [] 18 | 19 | [dependencies] 20 | proc-macro2.workspace = true 21 | quote.workspace = true 22 | rustc_version.workspace = true 23 | syn.workspace = true 24 | 25 | [dev-dependencies] 26 | cargo_metadata.workspace = true 27 | serde.workspace = true 28 | serde_json.workspace = true 29 | tokio.workspace = true 30 | typespec_client_core = { path = "../typespec_client_core", features = [ 31 | "http", 32 | "json", 33 | "xml", 34 | ] } 35 | 36 | [package.metadata.docs.rs] 37 | features = [] 38 | -------------------------------------------------------------------------------- /eng/common/testproxy/scripts/override-proxy-version.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Replaces target test-proxy version present in target_version.txt. 4 | 5 | .PARAMETER TargetVersion 6 | The replacement version. Used in its entirety, so don't exclude parts of the version definition. 7 | #> 8 | [cmdletbinding(SupportsShouldProcess=$True)] 9 | param( 10 | [Parameter(mandatory=$true)] [string] $TargetVersion 11 | ) 12 | 13 | $versionFile = Join-Path $PSScriptRoot ".." "target_version.txt" 14 | $existingVersionText = Get-Content -Raw -Path $versionFile 15 | $existingVersion = $existingVersionText.Trim() 16 | 17 | if ($PSCmdLet.ShouldProcess($versionFile)){ 18 | Write-Host "Replacing version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile." 19 | Set-Content -Path $versionFile -Value "$TargetVersion`n" 20 | } 21 | else { 22 | Write-Host "Would replace version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile." 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /.github/workflows/event.yml: -------------------------------------------------------------------------------- 1 | # NOTE: currently azure-sdk-actions only hosts check enforcer code. 2 | # If further functionality is added, this name should be updated to reflect 3 | # the more generic behavior 4 | name: Check Enforcer 5 | 6 | on: 7 | check_suite: 8 | types: [completed] 9 | issue_comment: 10 | types: [created] 11 | 12 | permissions: {} 13 | 14 | jobs: 15 | event-handler: 16 | permissions: 17 | statuses: write # to set status (azure/azure-sdk-actions) 18 | pull-requests: write # to read pull requests and write comments (azure/azure-sdk-actions) 19 | checks: read # to read check status (azure/azure-sdk-actions) 20 | name: Handle ${{ github.event_name }} ${{ github.event.action }} event 21 | runs-on: ubuntu-latest # This image is intentionally set to "latest", and not to a specific version 22 | steps: 23 | - uses: azure/azure-sdk-actions@main 24 | with: 25 | token: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/create-tags-and-git-release.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | ArtifactLocation: 'not-specified' 3 | PackageRepository: 'not-specified' 4 | PackageFilter: '' 5 | ReleaseSha: 'not-specified' 6 | RepoId: $(Build.Repository.Name) 7 | WorkingDirectory: '' 8 | ScriptDirectory: eng/common/scripts 9 | 10 | steps: 11 | - task: PowerShell@2 12 | displayName: 'Verify Package Tags and Create Git Releases' 13 | inputs: 14 | filePath: ${{ parameters.ScriptDirectory }}/create-tags-and-git-release.ps1 15 | arguments: > 16 | -artifactLocation ${{ parameters.ArtifactLocation }} 17 | -packageRepository ${{ parameters.PackageRepository }} 18 | -packageFilter "${{ parameters.PackageFilter }}" 19 | -releaseSha ${{ parameters.ReleaseSha }} 20 | -repoId ${{ parameters.RepoId }} 21 | -workingDirectory '${{ parameters.WorkingDirectory }}' 22 | pwsh: true 23 | timeoutInMinutes: 5 24 | env: 25 | GH_TOKEN: $(azuresdk-github-pat) 26 | -------------------------------------------------------------------------------- /eng/pipelines/templates/steps/vcpkg.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml 3 | 4 | - script: vcpkg --version 5 | condition: >- 6 | and( 7 | succeeded(), 8 | eq(variables['Agent.OS'], 'Windows_NT') 9 | ) 10 | displayName: vcpkg --version 11 | 12 | - pwsh: | 13 | vcpkg install 14 | Write-Host "##vso[task.setvariable variable=VCPKG_ROOT;]${env:VCPKG_INSTALLATION_ROOT}" 15 | Write-Host "##vso[task.setvariable variable=VCPKG_INSTALLED_ROOT;]$PWD\vcpkg_installed" 16 | Write-Host "##vso[task.setvariable variable=OPENSSL_DIR;]$PWD\vcpkg_installed\x64-windows" 17 | condition: >- 18 | and( 19 | succeeded(), 20 | eq(variables['Agent.OS'], 'Windows_NT') 21 | ) 22 | displayName: vcpkg install 23 | workingDirectory: eng/ 24 | env: 25 | VCPKG_BINARY_SOURCES: $(VCPKG_BINARY_SOURCES_SECRET) 26 | X_VCPKG_ASSET_SOURCES: $(X_VCPKG_ASSET_SOURCES_SECRET) 27 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | #![warn(missing_docs)] 7 | 8 | pub mod async_runtime; 9 | pub mod base64; 10 | pub mod error; 11 | pub mod fmt; 12 | #[cfg(feature = "http")] 13 | pub mod http; 14 | #[cfg(feature = "json")] 15 | pub use typespec::json; 16 | pub mod sleep; 17 | pub mod stream; 18 | pub mod time; 19 | #[cfg(feature = "http")] 20 | pub mod tracing; 21 | #[cfg(feature = "xml")] 22 | pub use typespec::xml; 23 | 24 | pub use crate::error::{Error, Result}; 25 | pub use typespec::Bytes; 26 | pub use uuid::Uuid; 27 | 28 | #[cfg(any(feature = "json", feature = "xml"))] 29 | pub use serde_json::Value; 30 | 31 | pub use sleep::sleep; 32 | 33 | mod private { 34 | #[allow(dead_code)] 35 | pub trait Sealed {} 36 | #[cfg(feature = "http")] 37 | impl Sealed for crate::http::Url {} 38 | } 39 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cSpell:ignore cosmosctest CRATETYPES endforeach 2 | 3 | project(cosmosctest C) 4 | cmake_minimum_required(VERSION 4.1) 5 | 6 | # CMake automatically uses this option, but we should define it. 7 | option(BUILD_SHARED_LIBS "Build using shared libraries" ON) 8 | 9 | include(FetchContent) 10 | include(CTest) 11 | 12 | FetchContent_Declare( 13 | Corrosion 14 | GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git 15 | GIT_TAG v0.5.2 16 | ) 17 | FetchContent_MakeAvailable(Corrosion) 18 | 19 | corrosion_import_crate( 20 | MANIFEST_PATH ./Cargo.toml 21 | CRATETYPES staticlib cdylib 22 | ) 23 | 24 | set(TEST_FILES 25 | ./c_tests/version.c) 26 | 27 | foreach(test_file ${TEST_FILES}) 28 | get_filename_component(test_name ${test_file} NAME_WE) 29 | add_executable(${test_name} ${test_file}) 30 | target_link_libraries(${test_name} PRIVATE azurecosmos) 31 | add_test(${test_name} ${test_name}) 32 | endforeach() 33 | 34 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/verify-changelog.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: PackageName 3 | type: string 4 | default: 'not-specified' 5 | - name: ServiceName 6 | type: string 7 | default: '' 8 | - name: ServiceDirectory 9 | type: string 10 | default: '' 11 | - name: ForRelease 12 | type: boolean 13 | default: false 14 | - name: Condition 15 | type: string 16 | default: succeeded() 17 | 18 | steps: 19 | - task: Powershell@2 20 | inputs: 21 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Verify-ChangeLog.ps1 22 | arguments: > 23 | -PackageName '${{ parameters.PackageName }}' 24 | -ServiceDirectory '${{ coalesce(parameters.ServiceDirectory, parameters.ServiceName) }}' 25 | -ForRelease $${{ parameters.ForRelease }} 26 | pwsh: true 27 | workingDirectory: $(Pipeline.Workspace) 28 | displayName: Verify ChangeLogEntry for ${{ parameters.PackageName }} 29 | condition: ${{ parameters.Condition }} 30 | continueOnError: false 31 | -------------------------------------------------------------------------------- /doc/git-commit-instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions for Git Commits 2 | 3 | - Git commits should follow the standard form: 4 | 5 | ```markdown 6 | title of no more than 50 characters 7 | 8 | multi-line descriptions 9 | ``` 10 | 11 | - Summarize changes for a title of no more than 50 characters ideally, with a hard stop at 80 characters. 12 | - Descriptions can be multiple lines or even paragraphs. 13 | - Descriptions may contain markdown. 14 | - Descriptions should not repeat a lot of content already found in the changed files. 15 | - Summarize changes for each file if no more than 10 files are changed. 16 | - If multiple files contain the same changes, group them together when summarizing changes. 17 | - Try to reason why changes were made and not about what was changed. 18 | - If any added comments in changed files reference fixing an issue like "Fixes #1234" include that same text in the description. 19 | - If the branch name includes an issue number like "issue1234" include "Fixes #1234" in the description. 20 | -------------------------------------------------------------------------------- /eng/common/testproxy/publish-proxy-logs.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | rootFolder: '$(Build.SourcesDirectory)' 3 | 4 | steps: 5 | - pwsh: | 6 | New-Item -ItemType Directory -Force "${{ parameters.rootFolder }}/proxy-logs" 7 | Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy.log" -Destination "${{ parameters.rootFolder }}/proxy-logs/proxy.log" 8 | Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy-error.log" -Destination "${{ parameters.rootFolder }}/proxy-logs/proxy-error.log" 9 | displayName: Copy Log File 10 | condition: succeededOrFailed() 11 | 12 | - template: ../pipelines/templates/steps/publish-artifact.yml 13 | parameters: 14 | ArtifactName: "$(System.StageName)-$(System.JobName)-$(System.JobAttempt)-proxy-logs" 15 | ArtifactPath: "${{ parameters.rootFolder }}/proxy-logs" 16 | 17 | - pwsh: | 18 | Remove-Item -Force ${{ parameters.rootFolder }}/proxy-logs/proxy.log 19 | displayName: Cleanup Copied Log File 20 | condition: succeededOrFailed() 21 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/request/options/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Options sent with requests to the service. 5 | 6 | use crate::http::headers::CLIENT_REQUEST_ID; 7 | pub use typespec_client_core::http::request::options::*; 8 | use typespec_client_core::request_header; 9 | 10 | request_header!( 11 | /// The `x-ms-client-request-id` header. 12 | /// 13 | /// # Examples 14 | /// 15 | /// Add a caller-defined client request ID to a request. 16 | /// 17 | /// ``` 18 | /// use azure_core::{ 19 | /// http::{ClientMethodOptions, request::options::ClientRequestId}, 20 | /// Uuid, 21 | /// }; 22 | /// let client_request_id: String = Uuid::new_v4().into(); 23 | /// let mut options = ClientMethodOptions::default(); 24 | /// options.context.insert(ClientRequestId::new(client_request_id)); 25 | /// ``` 26 | ClientRequestId, 27 | CLIENT_REQUEST_ID, 28 | ); 29 | -------------------------------------------------------------------------------- /eng/common/scripts/Get-BuildSourceDescription.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [string]$Variable, 3 | [switch]$IsOutput 4 | ) 5 | 6 | $repoUrl = $env:BUILD_REPOSITORY_URI 7 | $sourceBranch = $env:BUILD_SOURCEBRANCH 8 | 9 | $description = "[$sourceBranch]($repoUrl/tree/$sourceBranch)" 10 | if ($sourceBranch -match "^refs/heads/(.+)$") { 11 | $description = "Branch: [$($Matches[1])]($repoUrl/tree/$sourceBranch)" 12 | } elseif ($sourceBranch -match "^refs/tags/(.+)$") { 13 | $description = "Tag: [$($Matches[1])]($repoUrl/tree/$sourceBranch)" 14 | } elseif ($sourceBranch -match "^refs/pull/(\d+)/(head|merge)$") { 15 | $description = "Pull request: $repoUrl/pull/$($Matches[1])" 16 | } 17 | 18 | if ($IsOutput) { 19 | Write-Host "Setting output variable '$Variable' to '$description'" 20 | Write-Host "##vso[task.setvariable variable=$Variable;isoutput=true]$description" 21 | } else { 22 | Write-Host "Setting variable '$Variable' to '$description'" 23 | Write-Host "##vso[task.setvariable variable=$Variable]$description" 24 | } 25 | -------------------------------------------------------------------------------- /sdk/core/typespec/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "typespec" 3 | version = "0.11.0" 4 | authors.workspace = true 5 | edition.workspace = true 6 | rust-version.workspace = true 7 | description = "Project root for all TypeSpec-related crates." 8 | homepage = "https://typespec.io" 9 | repository.workspace = true 10 | license.workspace = true 11 | categories = ["compilers", "development-tools"] 12 | keywords = ["typespec"] 13 | 14 | [dependencies] 15 | base64.workspace = true 16 | bytes.workspace = true 17 | futures.workspace = true 18 | quick-xml = { workspace = true, optional = true } 19 | serde = { workspace = true, optional = true } 20 | serde_json = { workspace = true, optional = true } 21 | url.workspace = true 22 | 23 | [dev-dependencies] 24 | thiserror.workspace = true 25 | 26 | [features] 27 | default = ["http", "json"] 28 | http = [] 29 | json = ["dep:serde", "dep:serde_json"] 30 | xml = ["dep:serde", "dep:quick-xml"] 31 | 32 | [package.metadata.docs.rs] 33 | all-features = true 34 | 35 | [lints] 36 | workspace = true 37 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_storage_queue" 3 | version = "0.3.0" 4 | description = "Microsoft Azure Queue client library for Rust" 5 | readme = "README.md" 6 | authors.workspace = true 7 | edition.workspace = true 8 | license.workspace = true 9 | repository.workspace = true 10 | rust-version.workspace = true 11 | homepage = "https://github.com/azure/azure-sdk-for-rust" 12 | documentation = "https://docs.rs/azure_storage_queue" 13 | keywords = ["sdk", "azure", "storage", "queue", "queues"] 14 | categories = ["api-bindings"] 15 | 16 | [features] 17 | default = ["azure_core/default"] 18 | 19 | [dependencies] 20 | async-trait.workspace = true 21 | azure_core = { workspace = true, features = ["xml"] } 22 | serde = { workspace = true } 23 | 24 | [lints] 25 | workspace = true 26 | 27 | [dev-dependencies] 28 | azure_core_test.workspace = true 29 | azure_identity.workspace = true 30 | futures.workspace = true 31 | rand.workspace = true 32 | tokio = { workspace = true, features = ["macros"] } 33 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/src/generated/models/enums.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Licensed under the MIT License. See License.txt in the project root for license information. 4 | // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. 5 | 6 | /// The geo replication status. 7 | #[derive(Clone, Debug, Eq, PartialEq)] 8 | #[non_exhaustive] 9 | pub enum GeoReplicationStatusType { 10 | /// The geo replication is bootstrap. 11 | Bootstrap, 12 | 13 | /// The geo replication is live. 14 | Live, 15 | 16 | /// The geo replication is unavailable. 17 | Unavailable, 18 | 19 | /// Any other value not defined in `GeoReplicationStatusType`. 20 | UnknownValue(String), 21 | } 22 | 23 | /// Include this parameter to specify that the queue's metadata be returned as part of the response body. 24 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] 25 | #[non_exhaustive] 26 | pub enum ListQueuesIncludeType { 27 | /// Include metadata 28 | Metadata, 29 | } 30 | -------------------------------------------------------------------------------- /sdk/core/azure_core/src/http/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Types and functions for building HTTP clients. 5 | 6 | pub mod headers; 7 | mod models; 8 | mod options; 9 | pub mod pager; 10 | mod pipeline; 11 | pub mod policies; 12 | pub mod poller; 13 | pub mod request; 14 | 15 | pub use models::*; 16 | pub use options::*; 17 | pub use pager::{ItemIterator, PageIterator, Pager}; 18 | pub use pipeline::*; 19 | pub use poller::Poller; 20 | pub use request::{Body, Request, RequestContent}; 21 | pub use response::{AsyncRawResponse, AsyncResponse, RawResponse, Response}; 22 | 23 | pub use typespec_client_core::http::response; 24 | pub use typespec_client_core::http::{ 25 | new_http_client, AppendToUrlQuery, Context, DeserializeWith, Format, HttpClient, JsonFormat, 26 | Method, NoFormat, Sanitizer, StatusCode, Url, UrlExt, 27 | }; 28 | 29 | pub use crate::error::check_success; 30 | #[cfg(feature = "xml")] 31 | pub use typespec_client_core::http::XmlFormat; 32 | -------------------------------------------------------------------------------- /sdk/eventhubs/ci.yml: -------------------------------------------------------------------------------- 1 | # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. 2 | 3 | trigger: 4 | branches: 5 | include: 6 | - main 7 | - hotfix/* 8 | - release/* 9 | paths: 10 | include: 11 | - sdk/eventhubs/ 12 | 13 | parameters: 14 | - name: release_azure_messaging_eventhubs 15 | displayName: azure_messaging_eventhubs 16 | type: boolean 17 | default: false 18 | - name: release_azure_messaging_eventhubs_checkpointstore_blob 19 | displayName: azure_messaging_eventhubs_checkpointstore_blob 20 | type: boolean 21 | default: false 22 | 23 | extends: 24 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 25 | parameters: 26 | ServiceDirectory: eventhubs 27 | Artifacts: 28 | - name: azure_messaging_eventhubs 29 | releaseInBatch: ${{ parameters.release_azure_messaging_eventhubs }} 30 | - name: azure_messaging_eventhubs_checkpointstore_blob 31 | releaseInBatch: ${{ parameters.release_azure_messaging_eventhubs_checkpointstore_blob }} 32 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_queue/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | 6 | #[allow(unused_imports)] 7 | mod generated; 8 | 9 | /// Data models and types used by the Azure Storage Queue service. 10 | /// 11 | /// This module contains all the request and response models, enums, and other data types 12 | /// used when interacting with Azure Storage Queues, including queue messages, metadata, 13 | /// and service properties. 14 | pub mod models { 15 | pub use crate::generated::models::*; 16 | } 17 | 18 | /// Client implementations for interacting with Azure Storage Queue service. 19 | /// 20 | /// This module provides high-level client APIs for managing queues and queue messages, 21 | /// including operations like creating queues, sending/receiving messages, and managing 22 | /// queue metadata. 23 | pub mod clients; 24 | 25 | pub use clients::{QueueClient, QueueClientOptions, QueueServiceClient, QueueServiceClientOptions}; 26 | -------------------------------------------------------------------------------- /eng/scripts/Yank-Crates.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | 3 | #Requires -Version 7.0 4 | param( 5 | [string]$PackageInfoDirectory, 6 | [string[]]$CrateNames 7 | ) 8 | 9 | $ErrorActionPreference = 'Stop' 10 | Set-StrictMode -Version 2.0 11 | 12 | $hasErrors = $false 13 | foreach ($crateName in $crateNames) { 14 | $crate = Get-Content "$PackageInfoDirectory/$crateName.json" -Raw | ConvertFrom-Json 15 | $crateVersion = $crate.Version 16 | 17 | Write-Host "> cargo yank $crateName --version $crateVersion" 18 | cargo yank $crateName --version $crateVersion 2>&1 | Tee-Object -Variable output 19 | 20 | if ($LASTEXITCODE -ne 0) { 21 | if ($output -match 'status 404 Not Found') { 22 | Write-Host "Crate '$crateName@$crateVersion' not found. Skipping yank." 23 | } 24 | else { 25 | Write-Host "Error yanking crate: '$crateName@$crateVersion'" 26 | $hasErrors = $true 27 | } 28 | } 29 | else { 30 | Write-Host "Successfully yanked crate: '$crateName@$crateVersion'" 31 | } 32 | } 33 | 34 | if ($hasErrors) { 35 | exit 1 36 | } 37 | -------------------------------------------------------------------------------- /sdk/identity/ci.yml: -------------------------------------------------------------------------------- 1 | # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. 2 | # cSpell:disable 3 | trigger: 4 | branches: 5 | include: 6 | - main 7 | - hotfix/* 8 | - release/* 9 | paths: 10 | include: 11 | - sdk/identity/ 12 | 13 | parameters: 14 | - name: release_azure_identity 15 | displayName: azure_identity 16 | type: boolean 17 | default: false 18 | 19 | extends: 20 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 21 | parameters: 22 | ServiceDirectory: identity 23 | Artifacts: 24 | - name: azure_identity 25 | releaseInBatch: ${{ parameters.release_azure_identity }} 26 | 27 | ${{ if endsWith(variables['Build.DefinitionName'], 'weekly') }}: 28 | Location: uksouth 29 | RunLiveTests: true 30 | PersistOidcToken: true 31 | MatrixConfigs: 32 | - Name: managed_identity_matrix 33 | GenerateVMJobs: true 34 | Path: sdk/identity/azure_identity/managed-identity-matrix.json 35 | Selection: sparse 36 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: npmrcPath 3 | type: string 4 | - name: registryUrl 5 | type: string 6 | - name: CustomCondition 7 | type: string 8 | default: succeeded() 9 | 10 | steps: 11 | - pwsh: | 12 | Write-Host "Creating .npmrc file ${{ parameters.npmrcPath }} for registry ${{ parameters.registryUrl }}" 13 | $parentFolder = Split-Path -Path '${{ parameters.npmrcPath }}' -Parent 14 | 15 | if (!(Test-Path $parentFolder)) { 16 | Write-Host "Creating folder $parentFolder" 17 | New-Item -Path $parentFolder -ItemType Directory | Out-Null 18 | } 19 | 20 | $content = "registry=${{ parameters.registryUrl }}`n`nalways-auth=true" 21 | $content | Out-File '${{ parameters.npmrcPath }}' 22 | displayName: 'Create .npmrc' 23 | condition: ${{ parameters.CustomCondition }} 24 | - task: npmAuthenticate@0 25 | displayName: Authenticate .npmrc 26 | condition: ${{ parameters.CustomCondition }} 27 | inputs: 28 | workingFile: ${{ parameters.npmrcPath }} 29 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | pub use azure_canary_core::NumericCore; 5 | 6 | // Example modules organized by Rust concepts 7 | pub mod constant_example; 8 | pub mod enum_example; 9 | pub mod function_example; 10 | pub mod modules_example; 11 | pub mod static_example; 12 | pub mod struct_example; 13 | pub mod struct_fields_example; 14 | pub mod trait_example; 15 | pub mod use_example; 16 | 17 | // Re-export key examples for easier access 18 | pub use constant_example::MAX_CONNECTIONS; 19 | pub use enum_example::{Message, Status}; 20 | pub use static_example::PROGRAM_NAME; 21 | pub use struct_example::{Person, Point2D}; 22 | pub use trait_example::Shape; 23 | 24 | /// Basic function example 25 | pub fn add(left: u64, right: u64) -> u64 { 26 | left + right 27 | } 28 | 29 | #[cfg(test)] 30 | mod tests { 31 | use super::*; 32 | #[test] 33 | fn it_works() { 34 | let result = add(2, 2); 35 | assert_eq!(result, 4); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/perf-tests.yml: -------------------------------------------------------------------------------- 1 | Service: storage-blob 2 | 3 | Project: azure-storage-blobs-perf 4 | 5 | PrimaryPackage: azure_storage_blob 6 | 7 | PackageVersions: 8 | # - azure_storage_blob: 0.6.0 9 | # azure_core: 1.7.2 10 | - azure_storage_blob: source 11 | azure_core: source 12 | 13 | Tests: 14 | # - Test: download 15 | # Class: DownloadBlob 16 | # Arguments: 17 | # - --size 10240 --parallel 64 18 | # - --size 10485760 --parallel 32 19 | # - --size 1073741824 --parallel 1 --warmup 60 --duration 60 20 | # - --size 1073741824 --parallel 8 --warmup 60 --duration 60 21 | 22 | # - Test: upload 23 | # Class: UploadBlob 24 | # Arguments: 25 | # - --size 10240 --parallel 64 26 | # - --size 10485760 --parallel 32 27 | # - --size 1073741824 --parallel 1 --warmup 60 --duration 60 28 | # - --size 1073741824 --parallel 8 --warmup 60 --duration 60 29 | 30 | - Test: list-blobs 31 | Class: list_blob 32 | Arguments: 33 | - --count 5 --parallel 64 34 | - --count 500 --parallel 32 35 | - --count 50000 --parallel 32 --warmup 60 --duration 60 36 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/verify-readme.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: ScanPath 3 | type: string 4 | default: '' 5 | # Where ScanPath takes a single path, ScanPaths takes a comma separated list of paths to scan 6 | - name: ScanPaths 7 | type: string 8 | default: '' 9 | - name: RepoRoot 10 | type: string 11 | default: $(Build.SourcesDirectory) 12 | - name: SettingsPath 13 | type: string 14 | default: '$(Build.SourcesDirectory)/eng/.docsettings.yml' 15 | - name: DocWardenVersion 16 | type: string 17 | default: '' 18 | - name: Condition 19 | type: string 20 | default: succeeded() 21 | 22 | steps: 23 | - task: PowerShell@2 24 | displayName: "Verify Readmes" 25 | condition: ${{ parameters.Condition }} 26 | inputs: 27 | filePath: "eng/common/scripts/Verify-Readme.ps1" 28 | arguments: > 29 | -DocWardenVersion '${{ parameters.DocWardenVersion }}' 30 | -ScanPaths '${{ coalesce(parameters.ScanPath, parameters.ScanPaths) }}' 31 | -RepoRoot ${{ parameters.RepoRoot }} 32 | -SettingsPath ${{ parameters.SettingsPath }} 33 | pwsh: true -------------------------------------------------------------------------------- /doc/github-pullrequest-instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions for GitHub Pull Requests 2 | 3 | - GitHub Pull Requests should follow the standard form for Git commits: 4 | 5 | ```markdown 6 | title of no more than 50 characters 7 | 8 | multi-line descriptions 9 | ``` 10 | 11 | - Summarize changes for a title of no more than 50 characters ideally, with a hard stop at 80 characters. 12 | - Descriptions can be multiple lines or even paragraphs using markdown. 13 | - Descriptions may contain markdown. 14 | - Descriptions should not repeat a lot of content already found in the changed files. 15 | - Summarize changes for each file if no more than 10 files are changed. 16 | - If multiple files contain the same changes, group them together when summarizing changes. 17 | - Try to reason why changes were made and not about what was changed. 18 | - If any added comments in changed files reference fixing an issue like "Fixes #1234" include that same text in the description. 19 | - If multiple issues are fixed or resolved, include that same text separately for each issue like "Fixes #1234 and fixes #5678". 20 | -------------------------------------------------------------------------------- /eng/scripts/Get-PackageDependencies.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | #Requires -Version 7.0 3 | 4 | [CmdletBinding()] 5 | param( 6 | [switch]$Publishable, 7 | [switch]$NoDeveloperDependencies, 8 | [switch]$NoVersion 9 | ) 10 | 11 | $ErrorActionPreference = 'Stop' 12 | 13 | $packages = & (Join-Path $PSScriptRoot 'Get-PackageVersions.ps1') 14 | 15 | if ($Publishable) { 16 | $packages = $packages | Where-Object { $_.publish } 17 | } 18 | 19 | $dependencies = $packages | Select-Object -ExpandProperty packageDependencies 20 | 21 | if ($NoDev) { 22 | $dependencies = $dependencies | Where-Object { $_.kind -ne 'dev' } 23 | } 24 | 25 | if ($NoVersion) { 26 | $dependencies = $dependencies | Where-Object { $_.req -eq '*' } 27 | } 28 | 29 | $dependencies | Select-Object -Property @( 30 | @{ Name = 'from'; Expression = { $_.dependant } }, 31 | @{ Name = 'to'; Expression = { $_.name } }, 32 | 'kind', 33 | @{ Name = 'path'; Expression = { !!$_.path } }, 34 | 'req', 35 | @{ Name = 'local'; Expression = { $_.pathVersion } }, 36 | @{ Name = 'index'; Expression = { $_.indexVersion } } 37 | ) 38 | -------------------------------------------------------------------------------- /sdk/core/typespec_macros/tests/data/safe-debug-tests/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use typespec_client_core::fmt::SafeDebug; 5 | 6 | #[derive(SafeDebug)] 7 | #[safe(false)] 8 | pub struct Tuple(#[safe(true)] pub i32, pub &'static str); 9 | 10 | #[derive(SafeDebug)] 11 | pub struct EmptyTuple(); 12 | 13 | #[derive(SafeDebug)] 14 | pub struct Struct { 15 | #[safe(true)] 16 | pub a: i32, 17 | pub b: &'static str, 18 | } 19 | 20 | #[derive(SafeDebug)] 21 | pub struct EmptyStruct {} 22 | 23 | #[derive(SafeDebug)] 24 | pub struct UnitStruct; 25 | 26 | #[derive(SafeDebug)] 27 | pub enum Enum { 28 | Unit, 29 | Tuple(i32, &'static str), 30 | EmptyTuple(), 31 | #[safe(true)] 32 | Struct { 33 | a: i32, 34 | #[safe(false)] 35 | b: &'static str, 36 | }, 37 | EmptyStruct {}, 38 | } 39 | 40 | #[derive(SafeDebug)] 41 | #[safe(true)] 42 | pub struct MostlySafeStruct { 43 | #[safe(false)] 44 | pub name: &'static str, 45 | pub title: &'static str, 46 | } 47 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos_native/src/macros.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | macro_rules! c_str { 5 | ($s:expr) => { 6 | const { 7 | // This does a few funky things to make sure we can stay in a const context 8 | // Which ensures the string is generated as a c-str at compile time 9 | const STR: &str = $s; 10 | const BYTES: [u8; STR.len() + 1] = const { 11 | let mut cstr_buf: [u8; STR.len() + 1] = [0; STR.len() + 1]; 12 | let mut i = 0; 13 | // For loops over ranges don't work in const contexts yet. 14 | while i < STR.len() { 15 | cstr_buf[i] = STR.as_bytes()[i]; 16 | i += 1; 17 | } 18 | cstr_buf 19 | }; 20 | match CStr::from_bytes_with_nul(&BYTES) { 21 | Ok(cstr) => cstr, 22 | Err(_) => panic!("failed to convert value to C string"), 23 | } 24 | } 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/examples/eventhubs_properties.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | //! This sample shows retrieving the properties of an Event Hub. 5 | 6 | use azure_identity::DeveloperToolsCredential; 7 | use azure_messaging_eventhubs::ProducerClient; 8 | use std::env; 9 | 10 | #[tokio::main] 11 | async fn main() -> Result<(), Box> { 12 | // Initialize tracing subscriber from environment. 13 | tracing_subscriber::fmt().init(); 14 | 15 | let host = env::var("EVENTHUBS_HOST").unwrap(); 16 | let eventhub = env::var("EVENTHUB_NAME").unwrap(); 17 | 18 | let credential = DeveloperToolsCredential::new(None)?; 19 | 20 | let client = ProducerClient::builder() 21 | .with_application_id("test_get_properties".to_string()) 22 | .open(host.as_str(), eventhub.as_str(), credential.clone()) 23 | .await?; 24 | let properties = client.get_eventhub_properties().await?; 25 | println!("Eventhub Properties for: {eventhub} {properties:?}"); 26 | Ok(()) 27 | } 28 | -------------------------------------------------------------------------------- /sdk/core/perf.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: PackageVersions 3 | displayName: PackageVersions (regex of package versions to run) 4 | type: string 5 | default: 'source' 6 | - name: Tests 7 | displayName: Tests (regex of tests to run) 8 | type: string 9 | default: '.*' 10 | - name: Arguments 11 | displayName: Arguments (regex of arguments to run) 12 | type: string 13 | default: '.*' 14 | - name: Iterations 15 | displayName: Iterations (times to run each test) 16 | type: number 17 | default: 1 18 | - name: Profile 19 | type: boolean 20 | default: false 21 | - name: AdditionalArguments 22 | displayName: AdditionalArguments (passed to PerfAutomation) 23 | type: string 24 | default: ' ' 25 | 26 | extends: 27 | template: /eng/pipelines/templates/jobs/perf.yml@self 28 | parameters: 29 | ServiceDirectory: core 30 | PackageVersions: ${{ parameters.PackageVersions }} 31 | Tests: ${{ parameters.Tests }} 32 | Arguments: ${{ parameters.Arguments }} 33 | Iterations: ${{ parameters.Iterations }} 34 | AdditionalArguments: ${{ parameters.AdditionalArguments }} 35 | Profile: ${{ parameters.Profile }} 36 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test_macros/README.md: -------------------------------------------------------------------------------- 1 | # Azure client library test macros 2 | 3 | Macros for testing client libraries built on `azure_core`. 4 | 5 | ## Client methods 6 | 7 | To test client methods using our [Test Proxy] or run against live resources, you can attribute asynchronous tests 8 | using the `#[recorded::test]` attribute: 9 | 10 | ```rust 11 | use azure_core::Result; 12 | use azure_core_test::{recorded, TestContext}; 13 | 14 | #[recorded::test] 15 | async fn get_secret(ctx: TestContext) -> Result<()> { 16 | todo!() 17 | } 18 | ``` 19 | 20 | The `TestContext` parameter is required unless your test function is attribute as `#[recorded::test(live)]` (live-only). 21 | You can name the parameter whatever you want. 22 | The `TestContext` parameter is used to initialize an HTTP client to play back or record tests 23 | and provides other information to test functions that may be useful. 24 | 25 | These tests must also return a `std::result::Result`, which can be redefined e.g., `azure_core::Result`. 26 | 27 | [Test Proxy]: https://github.com/Azure/azure-sdk-tools/blob/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy/README.md 28 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/verify-samples.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: ServiceDirectory 3 | type: string 4 | default: '' 5 | - name: ServiceDirectories 6 | type: string 7 | default: '' 8 | - name: ScriptDirectory 9 | type: string 10 | default: eng/common/scripts 11 | 12 | steps: 13 | - pwsh: | 14 | # Take whichever parameter has been set. If set, ServiceDirectory will be a single path or 15 | # ServiceDirectories will be a comma separated list. 16 | $ServiceDirectories = '${{ coalesce(parameters.ServiceDirectory, parameters.ServiceDirectories) }}' 17 | $ScanPaths = @() 18 | foreach ($ServiceDirectory in $ServiceDirectories.Split(',')) { 19 | $ScanPath = [System.IO.Path]::Combine('$(Build.SourcesDirectory)', 'sdk', $ServiceDirectory) 20 | Write-Host "Adding $ScanPath to the scanned paths" 21 | $ScanPaths += $ScanPath 22 | } 23 | Get-ChildItem $ScanPaths -Filter *.md -Recurse | ${{ parameters.ScriptDirectory }}/Test-SampleMetadata.ps1 -AllowParentProducts 24 | displayName: Verify sample metadata 25 | workingDirectory: $(Build.SourcesDirectory) 26 | -------------------------------------------------------------------------------- /.config/guardian/.gdnbaselines: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "helpUri": "https://eng.ms/docs/microsoft-security/security/azure-security/cloudai-security-fundamentals-engineering/security-integration/guardian-wiki/microsoft-guardian/general/baselines" 4 | }, 5 | "version": "1.0.0", 6 | "baselines": { 7 | "default": { 8 | "name": "default", 9 | "createdDate": "2025-03-10 23:09:03Z", 10 | "lastUpdatedDate": "2025-03-10 23:09:03Z" 11 | } 12 | }, 13 | "results": { 14 | "40f143c4587e7f4d006ddddc5cd76cbb815237d6abbb7f4980030e24e3604a8c": { 15 | "signature": "40f143c4587e7f4d006ddddc5cd76cbb815237d6abbb7f4980030e24e3604a8c", 16 | "alternativeSignatures": [], 17 | "target": "sdk/keyvault/azure_security_keyvault_secrets/README.md", 18 | "line": 88, 19 | "memberOf": [ 20 | "default" 21 | ], 22 | "tool": "credscan", 23 | "ruleId": "CSCAN-GENERAL0060", 24 | "createdDate": "2025-03-21 02:33:58Z", 25 | "expirationDate": "2025-09-07 02:42:46Z", 26 | "justification": "This error is baselined with an expiration date of 180 days from 2025-03-21 02:42:46Z" 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/src/pipeline/storage_headers_policy.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use async_trait::async_trait; 5 | use azure_core::http::{ 6 | headers::CLIENT_REQUEST_ID, 7 | policies::{Policy, PolicyResult}, 8 | Context, Request, 9 | }; 10 | use std::sync::Arc; 11 | use uuid::Uuid; 12 | 13 | #[derive(Debug, Clone)] 14 | pub struct StorageHeadersPolicy; 15 | 16 | #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] 17 | #[cfg_attr(not(target_arch = "wasm32"), async_trait)] 18 | impl Policy for StorageHeadersPolicy { 19 | async fn send( 20 | &self, 21 | ctx: &Context, 22 | request: &mut Request, 23 | next: &[Arc], 24 | ) -> PolicyResult { 25 | if request 26 | .headers() 27 | .get_optional_string(&CLIENT_REQUEST_ID) 28 | .is_none() 29 | { 30 | let request_id = Uuid::new_v4().to_string(); 31 | request.insert_header(CLIENT_REQUEST_ID, &request_id); 32 | } 33 | next[0].send(ctx, request, &next[1..]).await 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/perf.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: PackageVersions 3 | displayName: PackageVersions (regex of package versions to run) 4 | type: string 5 | default: 'source' 6 | - name: Tests 7 | displayName: Tests (regex of tests to run) 8 | type: string 9 | default: '.*' 10 | - name: Arguments 11 | displayName: Arguments (regex of arguments to run) 12 | type: string 13 | default: '.*' 14 | - name: Iterations 15 | displayName: Iterations (times to run each test) 16 | type: number 17 | default: 1 18 | - name: Profile 19 | type: boolean 20 | default: false 21 | - name: AdditionalArguments 22 | displayName: AdditionalArguments (passed to PerfAutomation) 23 | type: string 24 | default: '' 25 | 26 | extends: 27 | template: /eng/pipelines/templates/jobs/perf.yml@self 28 | parameters: 29 | ServiceDirectory: eventhubs 30 | PackageVersions: ${{ parameters.PackageVersions }} 31 | Tests: ${{ parameters.Tests }} 32 | Arguments: ${{ parameters.Arguments }} 33 | Iterations: ${{ parameters.Iterations }} 34 | AdditionalArguments: ${{ parameters.AdditionalArguments }} 35 | Profile: ${{ parameters.Profile }} 36 | -------------------------------------------------------------------------------- /eng/common/scripts/Write-FileSystemMetrics.ps1: -------------------------------------------------------------------------------- 1 | $drives = [IO.DriveInfo]::GetDrives() | Where-Object { $_.TotalSize -gt 0 -and $_.DriveType -eq 'Fixed' -and $null -ne $_.Name } 2 | 3 | foreach($drive in $drives) { 4 | $entry = [ordered]@{ 5 | "name"= "agent_driveinfo_size_bytes"; 6 | "value"= $drive.TotalSize; 7 | "timestamp"= [DateTimeOffset]::UtcNow; 8 | "labels"= [ordered]@{ 9 | "name"= $drive.Name; 10 | "volumeLabel"= $drive.VolumeLabel; 11 | "driveType"= $drive.DriveType.ToString(); 12 | "driveFormat"= $drive.DriveFormat; 13 | } 14 | } 15 | 16 | Write-Output "logmetric: $($entry | ConvertTo-Json -Compress)" 17 | 18 | $entry = [ordered]@{ 19 | "name"= "agent_driveinfo_available_bytes"; 20 | "value"= $drive.AvailableFreeSpace; 21 | "timestamp"= [DateTimeOffset]::UtcNow; 22 | "labels"= [ordered]@{ 23 | "name"= $drive.Name; 24 | "volumeLabel"= $drive.VolumeLabel; 25 | "driveType"= $drive.DriveType.ToString(); 26 | "driveFormat"= $drive.DriveFormat; 27 | } 28 | } 29 | 30 | Write-Output "logmetric: $($entry | ConvertTo-Json -Compress)" 31 | } -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/async_runtime/tokio_runtime.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use super::{AsyncRuntime, SpawnedTask, TaskFuture}; 5 | use crate::time::Duration; 6 | use std::pin::Pin; 7 | 8 | /// An [`AsyncRuntime`] using `tokio` based APIs. 9 | pub(crate) struct TokioRuntime; 10 | 11 | impl AsyncRuntime for TokioRuntime { 12 | fn spawn(&self, f: TaskFuture) -> SpawnedTask { 13 | let handle = ::tokio::spawn(f); 14 | Box::pin(async move { 15 | handle 16 | .await 17 | .map_err(|e| Box::new(e) as Box) 18 | }) 19 | } 20 | 21 | fn sleep(&self, duration: Duration) -> Pin + Send>> { 22 | Box::pin(::tokio::time::sleep( 23 | duration 24 | .try_into() 25 | .expect("Failed to convert duration to tokio format"), 26 | )) 27 | } 28 | 29 | fn yield_now(&self) -> TaskFuture { 30 | Box::pin(async { 31 | tokio::task::yield_now().await; 32 | }) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/publish-blobs.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | FolderForUpload: '' 3 | TargetLanguage: '' 4 | BlobName: '' # To be removed once all usages are removed in the languages 5 | BlobAccountName: 'https://azuresdkdocs.blob.core.windows.net' 6 | ScriptPath: 'eng/common/scripts/copy-docs-to-blobstorage.ps1' 7 | ArtifactLocation: '' 8 | RepoId: $(Build.Repository.Name) 9 | 10 | steps: 11 | - template: /eng/common/pipelines/templates/steps/set-default-branch.yml 12 | 13 | - task: AzurePowerShell@5 14 | displayName: 'Copy Docs to Blob Storage' 15 | continueOnError: false 16 | inputs: 17 | azureSubscription: 'Azure SDK Artifacts' 18 | ScriptType: 'FilePath' 19 | ScriptPath: ${{ parameters.ScriptPath }} 20 | ScriptArguments: > 21 | -DocLocation "${{ parameters.FolderForUpload }}" 22 | -BlobAccountName "${{ parameters.BlobAccountName }}" 23 | -PublicArtifactLocation "${{ parameters.ArtifactLocation }}" 24 | -RepoReplaceRegex "(https://github.com/${{ parameters.RepoId }}/(?:blob|tree)/)$(DefaultBranch)" 25 | azurePowerShellVersion: latestVersion 26 | pwsh: true 27 | env: 28 | AZCOPY_AUTO_LOGIN_TYPE: 'PSCRED' 29 | -------------------------------------------------------------------------------- /eng/common/scripts/Update-PullRequest-In-ReleasePlan.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [Parameter(Mandatory = $true)] 3 | $ReleasePlanWorkItemId, 4 | [Parameter(Mandatory = $true)] 5 | $PullRequestUrl, 6 | [Parameter(Mandatory = $true)] 7 | $Status, 8 | [Parameter(Mandatory = $true)] 9 | $LanguageName 10 | ) 11 | 12 | <# 13 | .SYNOPSIS 14 | Updates the pull request URL and status in the specified release plan work item for a given programming language. 15 | 16 | .PARAMETER ReleasePlanWorkItemId 17 | The ID of the release plan work item to update. 18 | 19 | .PARAMETER PullRequestUrl 20 | The URL of the pull request to set in the release plan. 21 | 22 | .PARAMETER Status 23 | The status of the pull request. 24 | 25 | .PARAMETER LanguageName 26 | The programming language associated with the pull request. 27 | 28 | #> 29 | 30 | Set-StrictMode -Version 3 31 | . (Join-Path $PSScriptRoot common.ps1) 32 | . (Join-Path $PSScriptRoot Helpers DevOps-WorkItem-Helpers.ps1) 33 | 34 | 35 | LogDebug "Updating pull request in release plan" 36 | Update-PullRequestInReleasePlan $ReleasePlanWorkItemId $PullRequestUrl $Status $LanguageName 37 | LogDebug "Updated pull request in release plan" -------------------------------------------------------------------------------- /eng/common/scripts/Set-VcpkgWriteModeCache.ps1: -------------------------------------------------------------------------------- 1 | #!/bin/env pwsh 2 | param( 3 | [string] $StorageAccountName = 'azuresdkartifacts', 4 | [string] $StorageContainerName = 'public-vcpkg-container', 5 | [int] $TokenTimeoutInHours = 1 6 | ) 7 | 8 | $ctx = New-AzStorageContext ` 9 | -StorageAccountName $StorageAccountName ` 10 | -UseConnectedAccount 11 | 12 | $vcpkgBinarySourceSas = New-AzStorageContainerSASToken ` 13 | -Name $StorageContainerName ` 14 | -Permission "rwcl" ` 15 | -Context $ctx ` 16 | -ExpiryTime (Get-Date).AddHours($TokenTimeoutInHours) 17 | 18 | # Ensure redaction of SAS tokens in logs 19 | Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SAS_TOKEN;issecret=true;]$vcpkgBinarySourceSas" 20 | 21 | Write-Host "Setting vcpkg binary cache to read and write" 22 | Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azcopy-sas,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite" 23 | Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite" 24 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /eng/common/testproxy/install-test-proxy.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Installs a standalone version of the test-proxy for use in tests. This function is intended to be used in CI/CD pipelines, and leaves behind 4 | the pipeline variable PROXY_EXE which contains the path to the test-proxy executable. 5 | 6 | .PARAMETER Version 7 | The version of the proxy to install. Requires a full version to be provided. EG "1.0.0-dev.20240617.1" 8 | 9 | .PARAMETER Directory 10 | The directory within which the test-proxy exe will exist after this function invokes. Defaults to CWD. 11 | #> 12 | param( 13 | [Parameter(Mandatory = $true)] 14 | $Version, 15 | [Parameter(Mandatory = $true)] 16 | $InstallDirectory 17 | ) 18 | 19 | . (Join-Path $PSScriptRoot '..' 'scripts' 'Helpers' 'AzSdkTool-Helpers.ps1') 20 | 21 | Write-Host "Attempting to download and install version `"$Version`" into `"$InstallDirectory`"" 22 | 23 | $exe = Install-Standalone-Tool ` 24 | -Version $Version ` 25 | -FileName "test-proxy" ` 26 | -Package "Azure.Sdk.Tools.TestProxy" ` 27 | -Directory $InstallDirectory 28 | 29 | Write-Host "Downloaded test-proxy available at $exe." 30 | Write-Host "##vso[task.setvariable variable=PROXY_EXE]$exe" 31 | -------------------------------------------------------------------------------- /eng/dict/crates.txt: -------------------------------------------------------------------------------- 1 | async-lock 2 | async-stream 3 | async-trait 4 | azure_core 5 | azure_core 6 | azure_core_amqp 7 | azure_core_amqp 8 | azure_core_test 9 | azure_core_test 10 | azure_core_test_macros 11 | azure_core_test_macros 12 | azure_data_cosmos 13 | azure_identity 14 | azure_identity 15 | azure_messaging_eventhubs 16 | azure_security_keyvault_keys 17 | azure_security_keyvault_secrets 18 | azure_storage_blob 19 | azure_storage_common 20 | azure_template 21 | azure_template_core 22 | base64 23 | bytes 24 | cargo_metadata 25 | clap 26 | dotenvy 27 | dyn-clone 28 | fe2o3-amqp 29 | fe2o3-amqp-cbs 30 | fe2o3-amqp-ext 31 | fe2o3-amqp-management 32 | fe2o3-amqp-types 33 | flate2 34 | futures 35 | getrandom 36 | gloo 37 | hmac 38 | litemap 39 | log 40 | openssl 41 | pin-project 42 | proc-macro2 43 | quick-xml 44 | quote 45 | rand 46 | rand_chacha 47 | reqwest 48 | rustc_version 49 | serde 50 | serde_amqp 51 | serde_bytes 52 | serde_json 53 | serde_test 54 | serial_test 55 | sha2 56 | storage 57 | syn 58 | tar 59 | thiserror 60 | time 61 | tokio 62 | tracing 63 | tracing-subscriber 64 | typespec 65 | typespec 66 | typespec_client_core 67 | typespec_client_core 68 | typespec_macros 69 | typespec_macros 70 | ureq 71 | url 72 | uuid 73 | zerofrom 74 | zip 75 | moka -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/http/clients/noop.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use crate::{ 5 | error::Result, 6 | http::{AsyncRawResponse, Request}, 7 | }; 8 | use async_trait::async_trait; 9 | 10 | #[derive(Debug)] 11 | struct NoopClient; 12 | 13 | pub(crate) fn new_noop_client() -> std::sync::Arc { 14 | std::sync::Arc::new(NoopClient) 15 | } 16 | 17 | // TODO: We probably don't want to limit this to wasm32 since there will be wasm environments with threads. This should be a feature flag. 18 | #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] 19 | #[cfg_attr(not(target_arch = "wasm32"), async_trait)] 20 | impl super::HttpClient for NoopClient { 21 | #[allow(clippy::diverging_sub_expression)] 22 | async fn execute_request(&self, request: &Request) -> Result { 23 | panic!( 24 | "A request was called on the default http client `NoopClient`.\ 25 | This client does nothing but panic. Make sure to enable an http\ 26 | client that can actually perform requests. You can do this by ensuring that the `reqwest` feature is enabled.\n\ 27 | Request:\n{request:?}" 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sdk/canary/azure_canary_core/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![doc = include_str!("../README.md")] 5 | #![cfg_attr(docsrs, feature(doc_cfg))] 6 | #![warn(missing_docs)] 7 | 8 | /// Core numeric traits and types 9 | pub mod numeric { 10 | /// Core trait for numeric operations 11 | /// 12 | /// Provides basic numeric functionality that should be 13 | /// implemented by all numeric types in the SDK. 14 | pub trait NumericCore { 15 | /// Validates the numeric value 16 | fn is_valid(&self) -> bool; 17 | 18 | /// Converts the value to a string representation 19 | fn to_string(&self) -> String; 20 | } 21 | } 22 | 23 | pub use numeric::NumericCore; 24 | 25 | /// Adds two `u64` values and returns the result. 26 | /// 27 | /// # Examples 28 | /// ``` 29 | /// # use azure_canary_core::add; 30 | /// let sum = add(5, 10); 31 | /// assert_eq!(sum, 15); 32 | /// ``` 33 | pub fn add(left: u64, right: u64) -> u64 { 34 | left + right 35 | } 36 | 37 | #[cfg(test)] 38 | mod tests { 39 | use super::*; 40 | 41 | #[test] 42 | fn it_works() { 43 | let result = add(2, 2); 44 | assert_eq!(result, 4); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sdk/servicebus/azure_messaging_servicebus/examples/from_trait_usage.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | //! This example demonstrates the usage of the From trait implementations for Message creation. 5 | 6 | use azure_messaging_servicebus::Message; 7 | 8 | fn main() { 9 | // Using From<&'static str> 10 | let message1: Message = "Hello from static str!".into(); 11 | println!("Message 1 body: {}", message1.body_as_string().unwrap()); 12 | 13 | // Using From 14 | let text = String::from("Hello from owned String!"); 15 | let message2: Message = text.into(); 16 | println!("Message 2 body: {}", message2.body_as_string().unwrap()); 17 | 18 | // Using From<&'static str> with explicit syntax 19 | let message3 = Message::from("Hello with explicit from!"); 20 | println!("Message 3 body: {}", message3.body_as_string().unwrap()); 21 | 22 | // Using From with explicit syntax 23 | let dynamic_text = format!("Hello dynamic message {}", 42); 24 | let message4 = Message::from(dynamic_text); 25 | println!("Message 4 body: {}", message4.body_as_string().unwrap()); 26 | 27 | println!("All From trait implementations work correctly!"); 28 | } 29 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/examples/cosmos/metadata.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use std::error::Error; 5 | 6 | use azure_data_cosmos::CosmosClient; 7 | use clap::Args; 8 | 9 | /// Retrieves basic metadata about databases and containers. 10 | #[derive(Clone, Args)] 11 | pub struct MetadataCommand { 12 | /// The database to fetch information for. 13 | database: String, 14 | 15 | /// Optionally, the container to fetch information for. 16 | #[arg(long, short)] 17 | container: Option, 18 | } 19 | 20 | impl MetadataCommand { 21 | pub async fn run(self, client: CosmosClient) -> Result<(), Box> { 22 | let db_client = client.database_client(&self.database); 23 | if let Some(container_name) = &self.container { 24 | let container_client = db_client.container_client(container_name); 25 | let response = container_client.read(None).await?.into_model()?; 26 | println!("{:#?}", response); 27 | return Ok(()); 28 | } else { 29 | let response = db_client.read(None).await?.into_model()?; 30 | println!("{:#?}", response); 31 | } 32 | Ok(()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sdk/keyvault/test-resources.bicep: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | param baseName string = resourceGroup().name 5 | param tenantId string = '72f988bf-86f1-41af-91ab-2d7cd011db47' 6 | param testApplicationOid string 7 | param location string = resourceGroup().location 8 | @allowed(['standard', 'premium']) 9 | param keyVaultSku string = 'premium' 10 | 11 | var kvAdminDefinitionId = '00482a5a-887f-4fb3-b363-3b7fe8e74483' 12 | var kvAdminAssignmentName = guid(resourceGroup().id, kvAdminDefinitionId, testApplicationOid) 13 | 14 | resource kv 'Microsoft.KeyVault/vaults@2023-07-01' = { 15 | name: baseName 16 | location: location 17 | properties: { 18 | sku: { 19 | family: 'A' 20 | name: keyVaultSku 21 | } 22 | tenantId: tenantId 23 | enableRbacAuthorization: true 24 | softDeleteRetentionInDays: 7 25 | } 26 | } 27 | 28 | resource kvAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 29 | name: kvAdminAssignmentName 30 | properties: { 31 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', kvAdminDefinitionId) 32 | principalId: testApplicationOid 33 | } 34 | } 35 | 36 | output AZURE_KEYVAULT_URL string = kv.properties.vaultUri 37 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/rust 3 | { 4 | "name": "Azure SDK for Rust", 5 | "build": { 6 | "dockerfile": "Dockerfile" 7 | }, 8 | "onCreateCommand": ".devcontainer/oncreate", 9 | "features": { 10 | "ghcr.io/devcontainers/features/azure-cli:1": {}, 11 | "ghcr.io/devcontainers/features/docker-in-docker:2": {}, 12 | "ghcr.io/devcontainers/features/github-cli:1": {}, 13 | "ghcr.io/devcontainers/features/sshd:1": {}, 14 | "ghcr.io/devcontainers/features/dotnet:2": {}, 15 | "ghcr.io/devcontainers/features/powershell:1": {} 16 | }, 17 | "customizations": { 18 | "codespaces": { 19 | "repositories": { 20 | "Azure/azure-sdk-assets": { 21 | "permissions": { 22 | "contents": "write" 23 | } 24 | } 25 | } 26 | }, 27 | "vscode": { 28 | "extensions": [ 29 | "editorconfig.editorconfig", 30 | "GitHub.copilot", 31 | "rust-lang.rust-analyzer", 32 | "streetsidesoftware.code-spell-checker", 33 | "tamasfe.even-better-toml", 34 | "vadimcn.vscode-lldb" 35 | ] 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /eng/common/scripts/X509Certificate2/README.md: -------------------------------------------------------------------------------- 1 | Powershell module for generating self-signed x509 certificates 2 | 3 | Usage: 4 | 5 | ```powershell 6 | Import-Module -Name ./eng/common/scripts/X509Certificate2 # assumes $PWD is repo root 7 | 8 | $cert1 = New-X509Certificate2 -SubjectName 'E=opensource@microsoft.com, CN=Azure SDK, OU=Azure SDK, O=Microsoft, L=Redmond, S=WA, C=US' -ValidDays 3652 9 | 10 | $CaPublicKeyBase64 = $cert1 | Format-X509Certificate2 -Type CertificateBase64 11 | $CaPrivateKeyPem = $cert1 | Format-X509Certificate2 -Type Pkcs1 12 | $CaKeyPairPkcs12Base64 = $cert1 | Format-X509Certificate2 -Type Pkcs12Base64 13 | ``` 14 | 15 | With V3 extensions 16 | 17 | ```powershell 18 | Import-Module -Name eng/scripts/X509Certificate2.psm1 # assumes $PWD is repo root 19 | 20 | $cert2 = New-X509Certificate2 -SubjectName 'CN=Azure SDK' -SubjectAlternativeNames (New-X509Certificate2SubjectAlternativeNames -EmailAddress azuresdk@microsoft.com) -KeyUsageFlags KeyEncipherment, NonRepudiation, DigitalSignature -CA -TLS -ValidDays 3652 21 | 22 | $PemCertificateWithV3Extensions = ($cert2 | Format-X509Certificate2 -Type Certificate) + "`n" + ($cert2 | Format-X509Certificate2 -Type Pkcs8) 23 | $CertificateWithV3ExtensionsBase64 = $cert2 | Format-X509Certificate2 -Type CertificateBase64 24 | ``` 25 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/async_runtime/web_runtime.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use super::{AsyncRuntime, SpawnedTask, TaskFuture}; 5 | use crate::time::Duration; 6 | use futures::channel::oneshot; 7 | 8 | /// An [`AsyncRuntime`] using `wasm-bindgen-futures` for task spawning and `gloo-timers` for sleep functionality. 9 | pub(crate) struct WasmBindgenRuntime; 10 | 11 | impl AsyncRuntime for WasmBindgenRuntime { 12 | fn spawn(&self, f: TaskFuture) -> SpawnedTask { 13 | let (tx, rx) = oneshot::channel(); 14 | 15 | wasm_bindgen_futures::spawn_local(async move { 16 | let result = f.await; 17 | let _ = tx.send(result); 18 | }); 19 | 20 | Box::pin(async { 21 | rx.await 22 | .map_err(|e| Box::new(e) as Box) 23 | }) 24 | } 25 | 26 | fn sleep(&self, duration: Duration) -> TaskFuture { 27 | Box::pin(async move { 28 | if let Ok(d) = duration.try_into() { 29 | gloo_timers::future::sleep(d).await; 30 | } else { 31 | // This means the duration is negative, don't sleep at all. 32 | } 33 | }) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: PackageName 3 | type: string 4 | default: '' 5 | - name: PackageNames 6 | type: string 7 | default: '' 8 | - name: ServiceDirectory 9 | type: string 10 | default: '' 11 | - name: TagSeparator 12 | type: string 13 | default: '_' 14 | - name: TestPipeline 15 | type: boolean 16 | default: false 17 | - name: Artifacts 18 | type: object 19 | default: [] 20 | 21 | steps: 22 | - ${{ if eq(parameters.TestPipeline, true) }}: 23 | - task: PowerShell@2 24 | displayName: Prep template pipeline for release 25 | condition: and(succeeded(), ne(variables['Skip.SetTestPipelineVersion'], 'true')) 26 | inputs: 27 | workingDirectory: $(Build.SourcesDirectory) 28 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/SetTestPipelineVersion.ps1 29 | arguments: > 30 | -BuildID $(Build.BuildId) 31 | -PackageNames '${{ coalesce(parameters.PackageName, parameters.PackageNames) }}' 32 | -ServiceDirectory '${{ parameters.ServiceDirectory }}' 33 | -TagSeparator '${{ parameters.TagSeparator }}' 34 | -Artifacts @('${{ replace(convertToJson(parameters.Artifacts), '''', '`''') }}' | ConvertFrom-Json) 35 | pwsh: true 36 | -------------------------------------------------------------------------------- /sdk/core/azure_core_opentelemetry/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_core_opentelemetry" 3 | version = "0.5.0" 4 | description = "OpenTelemetry integration for the Azure SDK for Rust" 5 | readme = "README.md" 6 | authors.workspace = true 7 | license.workspace = true 8 | repository.workspace = true 9 | homepage = "https://github.com/azure/azure-sdk-for-rust" 10 | documentation = "https://docs.rs/azure_core_tracing_opentelemetry" 11 | keywords = ["sdk", "azure", "tracing", "opentelemetry", "observability"] 12 | categories = ["api-bindings", "development-tools::debugging"] 13 | edition.workspace = true 14 | rust-version.workspace = true 15 | 16 | [features] 17 | default = ["azure_core/default"] 18 | 19 | [dependencies] 20 | azure_core.workspace = true 21 | opentelemetry.workspace = true 22 | opentelemetry-http.workspace = true 23 | opentelemetry_sdk.workspace = true 24 | reqwest.workspace = true 25 | tracing.workspace = true 26 | 27 | [dev-dependencies] 28 | azure_core_test = { workspace = true, features = ["tracing"] } 29 | azure_core_test_macros.workspace = true 30 | azure_identity.workspace = true 31 | opentelemetry_sdk = { version = "0.30", features = ["testing"] } 32 | tokio.workspace = true 33 | tracing-subscriber.workspace = true 34 | url.workspace = true 35 | 36 | [lints] 37 | workspace = true 38 | -------------------------------------------------------------------------------- /sdk/cosmos/azure_data_cosmos/tests/framework/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #![allow( 5 | dead_code, 6 | reason = "Some tests don't use all the features of this module." 7 | )] 8 | #![allow( 9 | unused_imports, 10 | reason = "Some tests don't use all the features of this module." 11 | )] 12 | 13 | //! Provides a framework for integration tests for the Azure Cosmos DB service. 14 | //! 15 | //! The framework allows tests to easily run against real Cosmos DB instances, the local emulator, or a mock server using test-proxy. 16 | 17 | mod test_client; 18 | pub mod test_data; 19 | 20 | #[cfg(feature = "preview_query_engine")] 21 | pub mod query_engine; 22 | 23 | pub use test_client::{TestClient, TestRunContext}; 24 | 25 | use serde::{Deserialize, Serialize}; 26 | 27 | /// Represents a single item in the mock engine. 28 | #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)] 29 | #[serde(rename_all = "camelCase")] 30 | pub struct MockItem { 31 | /// The ID of the item. 32 | pub id: String, 33 | /// The partition key of the item. 34 | pub partition_key: String, 35 | /// The global merge order of the item, which will be used by the mock query pipeline to sort items. 36 | pub merge_order: usize, 37 | } 38 | -------------------------------------------------------------------------------- /eng/common/testproxy/dotnet-devcert.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDZzCCAk+gAwIBAgIUXUCvBB5U6rYQyAEu5rApzjp3RQYwDQYJKoZIhvcNAQEL 3 | BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI1MDcyMzE3NTUyM1oXDTI2MDcy 4 | MzE3NTUyM1owFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF 5 | AAOCAQ8AMIIBCgKCAQEA67HYsBPB865zJS8TDwUBgFSKqWgJ7dGTQh3aTlvamFED 6 | 5/kHnL7oTr3x/6Hylnajf0v4vGWmSok0/3SAcbpr/9l19/7zbpA1LLGzu8G909o5 7 | 38Wl5sNbGvQIMK91KxbHRXlVMKoYTIL38cNdZvhzfb9m9Tew6vPmz4ABMPiwYS9T 8 | R19lAPwmQYwce00NkKaQE5+6pzsPhnG/o/Ww9rBE370fidXn8jhqLSOEk+hbp3ju 9 | KlxeSrVHAqlvTzlvSTZGRyxioRLDEMFT3ka1cyLo6HP3U7lj76mlJBibahE+ylL+ 10 | z594fzHnfYPQaN5g13G9H2oxTg+VwwNtL1U737FNiwIDAQABo4GwMIGtMA8GA1Ud 11 | EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGmMBYGA1UdJQEB/wQMMAoGCCsGAQUF 12 | BwMBMBcGA1UdEQEB/wQNMAuCCWxvY2FsaG9zdDA6BgorBgEEAYI3VAEBBCwMKkFT 13 | UC5ORVQgQ29yZSBIVFRQUyBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTAdBgNVHQ4E 14 | FgQUg5xH/y5mh7lGgF+y+1sJC7ZMN9owDQYJKoZIhvcNAQELBQADggEBAK/gRk/L 15 | 5q4/xXXYW77WawygxpGmTgBLDHkiJViMnJ4VDk6q97/DMABIqCp3sv3FNP9sOssG 16 | ypgmX4jYbyrLNwfvdtpVaiHAHvrTfAtrfHgG0EVM1DRUJ1e0/SRfYf1QTdVxEZv+ 17 | 3IM+0roYa8EtQq8BxSsAZz+zhNMoav8nXQVhR7+v5NI5vzT0TVncfXIYYYfLhllb 18 | wcmh9iQuXMifj7WohOFE1XK4O6Bats/6V85ZSGDl3npEpYcgBwyxNQE5hKn/lG5b 19 | 3DDkpCTeoMZxAHLo39RzAy0WJTF1KPHQ2EzUa+MfoTNWNrhYSW3IqI3xfPzevSDx 20 | BTBk4gS9MSt2Jj8= 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /eng/common/instructions/azsdk-tools/typespec-docs.instructions.md: -------------------------------------------------------------------------------- 1 | Your goal is to provide the most up-to-date documentation on the TypeSpec language, core libraries, and writing Azure services and clients in TypeSpec. Whenever a user asks a question about how something should be written in TypeSpec, you should use the documentation links below to pinpoint the most relevant and accurate information. 2 | 3 | ## TypeSpec Azure 4 | 5 | - https://azure.github.io/typespec-azure/docs/llms.txt contains an index of up-to-date documentation for TypeSpec Azure libraries, including how to write service specifications for Azure Resource Manager (ARM) and Azure Data Plane services, as well as how to customize generated clients. 6 | - Always refer to https://azure.github.io/typespec-azure/docs/llms.txt when a user asks TypeSpec related questions in case there is existing documentation that can help answer them. This also applies when a user asks to make changes to TypeSpec specifications. 7 | 8 | ## TypeSpec documentation 9 | 10 | - https://typespec.io/docs/llms.txt contains an index of up-to-date documentation for TypeSpec language basics and core libraries, including how concepts like visibility and versioning work. 11 | - Always refer to https://typespec.io/docs/llms.txt when a user asks TypeSpec related questions that aren't covered by the TypeSpec Azure topics. 12 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/set-vcpkg-cache-vars.yml: -------------------------------------------------------------------------------- 1 | 2 | parameters: 3 | - name: TokenTimeoutInHours 4 | type: number 5 | default: 1 6 | 7 | steps: 8 | - pwsh: | 9 | Write-Host "Setting vcpkg cache variables for read only access to vcpkg binary and asset caches" 10 | Write-Host '##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azcopy,https://azuresdkartifacts.blob.core.windows.net/public-vcpkg-container,read' 11 | Write-Host '##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://azuresdkartifacts.blob.core.windows.net/public-vcpkg-container,,read' 12 | displayName: Set vcpkg variables 13 | 14 | - ${{if eq(variables['System.TeamProject'], 'internal') }}: 15 | - task: AzurePowerShell@5 16 | displayName: Set Vcpkg Write-mode Cache 17 | inputs: 18 | azureSubscription: 'Azure SDK Artifacts' 19 | ScriptType: FilePath 20 | ScriptPath: eng/common/scripts/Set-VcpkgWriteModeCache.ps1 21 | ScriptArguments: -TokenTimeoutInHours ${{ parameters.TokenTimeoutInHours }} 22 | azurePowerShellVersion: LatestVersion 23 | pwsh: true 24 | # This step is idempotent and can be run multiple times in cases of 25 | # failure and partial execution. 26 | retryCountOnTaskFailure: 3 27 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/perf/perf_tests.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Keyvault Keys performance tests. 5 | //! 6 | //! This test measures the performance of getting a secret from Azure Key Vault. 7 | //! It sets up a secret in the Key Vault during the setup phase and then repeatedly retrieves it 8 | //! during the run phase. The test can be configured with the vault URL via command line arguments 9 | //! to target different Key Vault instances. 10 | //! 11 | //! To run the test, use the following command line arguments: 12 | //! 13 | //! cargo bench --package azure_security_keyvault_keys --bench perf -- --duration 10 --parallel 20 get_key -u https://.vault.azure.net/ 14 | //! 15 | 16 | mod create_key; 17 | mod get_key; 18 | 19 | use azure_core_test::perf::PerfRunner; 20 | 21 | /// Environment variable for the Azure Key Vault URL 22 | pub const ENV_NAME: &str = "AZURE_KEYVAULT_URL"; 23 | 24 | #[tokio::main] 25 | async fn main() -> azure_core::Result<()> { 26 | let runner = PerfRunner::new( 27 | env!("CARGO_MANIFEST_DIR"), 28 | file!(), 29 | vec![ 30 | create_key::CreateKey::test_metadata(), 31 | get_key::GetKey::test_metadata(), 32 | ], 33 | )?; 34 | runner.run().await 35 | } 36 | -------------------------------------------------------------------------------- /sdk/core/azure_core_test/src/recording/policy.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | //! Policies for recordings. 5 | 6 | use async_trait::async_trait; 7 | use azure_core::{ 8 | http::{ 9 | policies::{Policy, PolicyResult}, 10 | AsyncRawResponse, Context, Request, 11 | }, 12 | test::RecordingMode, 13 | }; 14 | use std::sync::Arc; 15 | 16 | /// Adds the `x-recording-mode` header to test responses. 17 | #[derive(Debug)] 18 | pub struct RecordingModePolicy { 19 | mode: RecordingMode, 20 | } 21 | 22 | impl RecordingModePolicy { 23 | /// Create a new `RecordingModePolicy`. 24 | pub fn new(mode: RecordingMode) -> Self { 25 | Self { mode } 26 | } 27 | } 28 | 29 | #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] 30 | #[cfg_attr(not(target_arch = "wasm32"), async_trait)] 31 | impl Policy for RecordingModePolicy { 32 | async fn send( 33 | &self, 34 | ctx: &Context, 35 | request: &mut Request, 36 | next: &[Arc], 37 | ) -> PolicyResult { 38 | let resp = next[0].send(ctx, request, &next[1..]).await?; 39 | let (status, mut headers, body) = resp.deconstruct(); 40 | headers.add(self.mode)?; 41 | 42 | Ok(AsyncRawResponse::new(status, headers, Box::pin(body))) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /eng/common/instructions/azsdk-tools/check-package-validation.instructions.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: 'Run the package validation checks for the SDK package.' 3 | --- 4 | ## Goal 5 | Run the validation checks for the SDK package by collecting the required information from the user and executing the `azsdk_package_run_check` tool. 6 | 7 | ## Instructions 8 | 1. **Collect Required Information**: 9 | - Prompt the user for the absolute package path to the package directory for the SDK package they want to check. 10 | - Prompt the user to specify values for each of the parameters required by the azsdk_package_run_check tool. Present the user with options to pick from for the allowed values specified by the parameter schema. 11 | 12 | 2. **Execute Check**: 13 | - Use the `azsdk_package_run_check` tool with the package path and check type. 14 | 15 | 3. **Present Results**: 16 | - If the package has passed all validation checks, highlight and finish 17 | - If the package is not ready, display the specific check types that need to be fixed for each language. 18 | 19 | ## Expected User Interaction Flow 20 | 1. Ask: "What is the exact path of the package you want to check for validation?" 21 | 2. Ask: "Please specify the check type you want to run (e.g., 'all', 'linting', 'format', etc.)" 22 | 3. Execute the check using the provided information 23 | 4. Display results and next steps -------------------------------------------------------------------------------- /sdk/eventhubs/azure_messaging_eventhubs/src/common/user_agent.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All Rights reserved 2 | // Licensed under the MIT license. 3 | 4 | use std::env::consts::{ARCH, OS}; 5 | 6 | const UNKNOWN: &str = "unknown"; 7 | 8 | pub(crate) fn get_user_agent(application_id: &Option) -> String { 9 | let rustc_version = option_env!("AZSDK_RUSTC_VERSION").unwrap_or(UNKNOWN); 10 | let mut crate_name = get_package_name(); 11 | let crate_version = get_package_version(); 12 | let platform_info = format!("({rustc_version}; {OS}; {ARCH})",); 13 | 14 | if let Some(name) = crate_name.strip_prefix("azure_") { 15 | crate_name = name.to_string(); 16 | } 17 | 18 | match &application_id { 19 | Some(application_id) => { 20 | format!("{application_id} azsdk-rust-{crate_name}/{crate_version} {platform_info}") 21 | } 22 | None => format!("azsdk-rust-{crate_name}/{crate_version} {platform_info}"), 23 | } 24 | } 25 | 26 | pub(crate) fn get_package_version() -> String { 27 | option_env!("CARGO_PKG_VERSION") 28 | .unwrap_or(UNKNOWN) 29 | .to_string() 30 | } 31 | 32 | pub(crate) fn get_platform_info() -> String { 33 | OS.to_string() 34 | } 35 | 36 | pub(crate) fn get_package_name() -> String { 37 | option_env!("CARGO_PKG_NAME").unwrap_or(UNKNOWN).to_string() 38 | } 39 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/stages/archetype-sdk-tool-pwsh.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: TargetDirectory 3 | type: string 4 | - name: CustomTestSteps 5 | type: object 6 | default: [] 7 | - name: EnvVars 8 | type: object 9 | default: {} 10 | - name: TargetTags 11 | type: string 12 | default: '' 13 | - name: PreTestSteps 14 | type: object 15 | default: [] 16 | 17 | variables: 18 | - template: /eng/pipelines/templates/variables/globals.yml 19 | 20 | stages: 21 | - stage: 22 | displayName: Run PowerShell Tests 23 | jobs: 24 | - job: Test 25 | strategy: 26 | matrix: 27 | Windows: 28 | Pool: azsdk-pool 29 | Image: windows-2022 30 | Linux: 31 | Pool: azsdk-pool 32 | Image: ubuntu-24.04 33 | 34 | pool: 35 | name: $(Pool) 36 | demands: ImageOverride -equals $(Image) 37 | 38 | steps: 39 | - ${{ parameters.PreTestSteps }} 40 | 41 | - template: /eng/common/pipelines/templates/steps/run-pester-tests.yml 42 | parameters: 43 | TargetDirectory: ${{ parameters.TargetDirectory }} 44 | CustomTestSteps: ${{ parameters.CustomTestSteps }} 45 | EnvVars: ${{ parameters.EnvVars }} 46 | TargetTags: ${{ parameters.TargetTags }} 47 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/perf-resources.bicep: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | param baseName string = resourceGroup().name 5 | param tenantId string 6 | param testApplicationOid string 7 | param location string = resourceGroup().location 8 | @allowed(['standard', 'premium']) 9 | param keyVaultSku string = 'premium' 10 | 11 | var kvAdminDefinitionId = '00482a5a-887f-4fb3-b363-3b7fe8e74483' 12 | var kvAdminAssignmentName = guid(resourceGroup().id, kvAdminDefinitionId, testApplicationOid) 13 | 14 | resource kv 'Microsoft.KeyVault/vaults@2023-07-01' = { 15 | name: baseName 16 | location: location 17 | properties: { 18 | sku: { 19 | family: 'A' 20 | name: keyVaultSku 21 | } 22 | tenantId: tenantId 23 | enabledForDeployment: false 24 | enabledForDiskEncryption: false 25 | enabledForTemplateDeployment: false 26 | enableRbacAuthorization: true 27 | softDeleteRetentionInDays: 7 28 | } 29 | } 30 | 31 | resource kvAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 32 | name: kvAdminAssignmentName 33 | properties: { 34 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', kvAdminDefinitionId) 35 | principalId: testApplicationOid 36 | } 37 | } 38 | 39 | output AZURE_KEYVAULT_URL string = kv.properties.vaultUri 40 | -------------------------------------------------------------------------------- /sdk/core/azure_core/perf.yml: -------------------------------------------------------------------------------- 1 | trigger: none 2 | 3 | pr: none 4 | 5 | schedules: 6 | - cron: "0 7 * * *" 7 | displayName: Daily midnight build 8 | branches: 9 | include: 10 | - main 11 | always: true 12 | 13 | parameters: 14 | - name: PackageVersions 15 | displayName: PackageVersions (regex of package versions to run) 16 | type: string 17 | default: '12|source' 18 | - name: Tests 19 | displayName: Tests (regex of tests to run) 20 | type: string 21 | default: '^(mock_json|mock_xml)$' 22 | - name: Arguments 23 | displayName: Arguments (regex of arguments to run) 24 | type: string 25 | default: '(5)|(500)|(50000)' 26 | - name: Iterations 27 | displayName: Iterations (times to run each test) 28 | type: number 29 | default: '5' 30 | - name: Profile 31 | type: boolean 32 | default: false 33 | - name: AdditionalArguments 34 | displayName: AdditionalArguments (passed to PerfAutomation) 35 | type: string 36 | default: '' 37 | 38 | extends: 39 | template: /eng/pipelines/templates/jobs/perf.yml 40 | parameters: 41 | ServiceDirectory: core/azure_core 42 | PackageVersions: ${{ parameters.PackageVersions }} 43 | Tests: ${{ parameters.Tests }} 44 | Arguments: ${{ parameters.Arguments }} 45 | Iterations: ${{ parameters.Iterations }} 46 | AdditionalArguments: ${{ parameters.AdditionalArguments }} 47 | Profile: ${{ parameters.Profile }} 48 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml: -------------------------------------------------------------------------------- 1 | # This script fragment is used across our repos to set a variable "SetDevVersion" which 2 | # is used when this pipeline is going to be generating and publishing daily dev builds. 3 | parameters: 4 | ServiceDirectory: '' 5 | Artifacts: [] 6 | Condition: succeeded() 7 | steps: 8 | - ${{if ne(parameters.ServiceDirectory, '')}}: 9 | - task: Powershell@2 10 | inputs: 11 | filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1 12 | arguments: > 13 | -ServiceDirectory ${{parameters.ServiceDirectory}} 14 | -OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo 15 | -artifactList @('${{ replace(convertToJson(parameters.Artifacts), '''', '`''') }}' | ConvertFrom-Json | Select-Object -ExpandProperty name) 16 | pwsh: true 17 | workingDirectory: $(Pipeline.Workspace) 18 | displayName: Dump Package properties 19 | condition: ${{ parameters.Condition }} 20 | - pwsh: | 21 | $setDailyDevBuild = "false" 22 | if (('$(Build.Reason)' -eq 'Schedule') -and ('$(System.TeamProject)' -eq 'internal')) { 23 | $setDailyDevBuild = "true" 24 | } 25 | echo "##vso[task.setvariable variable=SetDevVersion]$setDailyDevBuild" 26 | displayName: "Setup Versioning Properties" 27 | condition: and(${{ parameters.Condition }}, eq(variables['SetDevVersion'], '')) 28 | -------------------------------------------------------------------------------- /sdk/core/typespec_client_core/src/http/policies/retry/none.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use crate::http::{ 5 | policies::{Policy, PolicyResult, RetryHeaders}, 6 | Context, Request, 7 | }; 8 | use std::sync::Arc; 9 | 10 | /// Retry policy that does not retry. 11 | /// 12 | /// Use this policy as a stub to disable retry policies altogether. 13 | #[derive(Default, Debug, Clone, PartialEq, Eq)] 14 | pub(crate) struct NoRetryPolicy { 15 | retry_headers: RetryHeaders, 16 | } 17 | 18 | impl NoRetryPolicy { 19 | /// Create a new `NoRetryPolicy`. 20 | pub fn new(retry_headers: RetryHeaders) -> Self { 21 | Self { retry_headers } 22 | } 23 | } 24 | 25 | #[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))] 26 | #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)] 27 | impl Policy for NoRetryPolicy { 28 | async fn send( 29 | &self, 30 | ctx: &Context, 31 | request: &mut Request, 32 | next: &[Arc], 33 | ) -> PolicyResult { 34 | // just call the following policies and bubble up the error. 35 | // Note that we do *not* modify the error to add HTTP error information, 36 | // that is the responsibility of the service clients. 37 | Ok(next[0].send(ctx, request, &next[1..]).await?) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/publish-artifact.yml: -------------------------------------------------------------------------------- 1 | # This step is used to prevent duplication of artifact publishes when there is an issue that would prevent the overall success of the job. 2 | # Ensuring that we only publish when successful (and two a differently named artifact otherwise) will allow easy retry on a build pipeline 3 | # without running into the "cannot override artifact" failure when we finally do get a passing run. 4 | 5 | # ArtifactName - The name of the artifact in the "successful" case. 6 | # ArtifactPath - The path we will be publishing. 7 | # CustomCondition - Used if there is additional logic necessary to prevent attempt of publish. 8 | 9 | parameters: 10 | ArtifactName: '' 11 | ArtifactPath: '' 12 | CustomCondition: true 13 | 14 | steps: 15 | - task: PublishPipelineArtifact@1 16 | condition: and(succeeded(), ${{ parameters.CustomCondition }}) 17 | displayName: 'Publish ${{ parameters.ArtifactName }} Artifacts' 18 | inputs: 19 | artifactName: '${{ parameters.ArtifactName }}' 20 | path: '${{ parameters.ArtifactPath }}' 21 | 22 | - task: PublishPipelineArtifact@1 23 | condition: and(failed(), ${{ parameters.CustomCondition }}) 24 | displayName: 'Publish failed ${{ parameters.ArtifactName }} Artifacts' 25 | inputs: 26 | artifactName: '${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)' 27 | path: '${{ parameters.ArtifactPath }}' 28 | -------------------------------------------------------------------------------- /sdk/storage/azure_storage_blob/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "azure_storage_blob" 3 | version = "0.8.0" 4 | description = "Microsoft Azure Blob Storage client library for Rust" 5 | readme = "README.md" 6 | authors.workspace = true 7 | edition.workspace = true 8 | license.workspace = true 9 | repository.workspace = true 10 | rust-version.workspace = true 11 | homepage = "https://github.com/azure/azure-sdk-for-rust" 12 | documentation = "https://docs.rs/azure_storage_blob" 13 | keywords = ["sdk", "azure", "storage", "blob", "blobs"] 14 | categories = ["api-bindings"] 15 | 16 | [features] 17 | default = ["azure_core/default"] 18 | 19 | [dependencies] 20 | async-trait.workspace = true 21 | azure_core = { workspace = true, features = ["xml"] } 22 | bytes.workspace = true 23 | futures.workspace = true 24 | pin-project.workspace = true 25 | serde.workspace = true 26 | serde_json.workspace = true 27 | time.workspace = true 28 | url.workspace = true 29 | uuid.workspace = true 30 | 31 | [lints] 32 | workspace = true 33 | 34 | [dev-dependencies] 35 | azure_core_test = { workspace = true, features = [ 36 | "tracing", 37 | ] } 38 | azure_identity.workspace = true 39 | azure_storage_blob_test.path = "../azure_storage_blob_test" 40 | futures.workspace = true 41 | rand.workspace = true 42 | tokio = { workspace = true, features = ["macros"] } 43 | tracing.workspace = true 44 | 45 | [[bench]] 46 | name = "perf" 47 | path = "perf/perf_tests.rs" 48 | harness = false 49 | -------------------------------------------------------------------------------- /sdk/storage/ci.yml: -------------------------------------------------------------------------------- 1 | # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. 2 | trigger: 3 | branches: 4 | include: 5 | - main 6 | - hotfix/* 7 | - release/* 8 | paths: 9 | include: 10 | - sdk/storage/ 11 | 12 | parameters: 13 | - name: RunLiveTests 14 | displayName: Run live tests 15 | type: boolean 16 | default: false 17 | - name: release_azure_storage_common 18 | displayName: azure_storage_common 19 | type: boolean 20 | default: false 21 | - name: release_azure_storage_blob 22 | displayName: azure_storage_blob 23 | type: boolean 24 | default: false 25 | - name: release_azure_storage_queue 26 | displayName: azure_storage_queue 27 | type: boolean 28 | default: false 29 | 30 | extends: 31 | template: /eng/pipelines/templates/stages/archetype-sdk-client.yml 32 | parameters: 33 | ServiceDirectory: storage 34 | RunLiveTests: ${{ or(parameters.RunLiveTests, eq(variables['Build.Reason'], 'Schedule')) }} 35 | TestTimeoutInMinutes: 120 36 | Artifacts: 37 | # Artifact order in this file maps to order evaluated by Pack-Crates.ps1 38 | # When the artifacts like blob and queue depend on common, common will need 39 | # to be listed first. 40 | - name: azure_storage_blob 41 | releaseInBatch: ${{ parameters.release_azure_storage_blob }} 42 | - name: azure_storage_queue 43 | releaseInBatch: ${{ parameters.release_azure_storage_queue }} 44 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_secrets/perf-resources.bicep: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | param baseName string = resourceGroup().name 5 | param tenantId string 6 | param testApplicationOid string 7 | param location string = resourceGroup().location 8 | @allowed(['standard', 'premium']) 9 | param keyVaultSku string = 'premium' 10 | param enableSoftDelete bool = true 11 | 12 | var kvAdminDefinitionId = '00482a5a-887f-4fb3-b363-3b7fe8e74483' 13 | var kvAdminAssignmentName = guid(resourceGroup().id, kvAdminDefinitionId, testApplicationOid) 14 | 15 | resource kv 'Microsoft.KeyVault/vaults@2023-07-01' = { 16 | name: baseName 17 | location: location 18 | properties: { 19 | sku: { 20 | family: 'A' 21 | name: keyVaultSku 22 | } 23 | tenantId: tenantId 24 | enabledForDeployment: false 25 | enabledForDiskEncryption: false 26 | enabledForTemplateDeployment: false 27 | enableSoftDelete: enableSoftDelete 28 | enableRbacAuthorization: true 29 | softDeleteRetentionInDays: 7 30 | } 31 | } 32 | 33 | resource kvAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = { 34 | name: kvAdminAssignmentName 35 | properties: { 36 | roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', kvAdminDefinitionId) 37 | principalId: testApplicationOid 38 | } 39 | } 40 | 41 | output AZURE_KEYVAULT_URL string = kv.properties.vaultUri 42 | -------------------------------------------------------------------------------- /sdk/keyvault/azure_security_keyvault_keys/perf.yml: -------------------------------------------------------------------------------- 1 | trigger: none 2 | 3 | pr: none 4 | 5 | # Schedule the pipeline to run at UTC+7 Hours (Midnight Pacific time) 6 | schedules: 7 | - cron: "0 7 * * *" 8 | displayName: Daily midnight run. 9 | branches: 10 | include: 11 | - main 12 | always: true 13 | 14 | parameters: 15 | - name: PackageVersions 16 | displayName: PackageVersions (regex of package versions to run) 17 | type: string 18 | default: 'source' 19 | - name: Tests 20 | displayName: Tests (regex of tests to run) 21 | type: string 22 | default: '.*' 23 | - name: Arguments 24 | displayName: Arguments (regex of arguments to run) 25 | type: string 26 | default: '.*' 27 | - name: Iterations 28 | displayName: Iterations (times to run each test) 29 | type: number 30 | default: 1 31 | - name: Profile 32 | type: boolean 33 | default: false 34 | - name: AdditionalArguments 35 | displayName: AdditionalArguments (passed to PerfAutomation) 36 | type: string 37 | default: ' ' 38 | 39 | extends: 40 | template: /eng/pipelines/templates/jobs/perf.yml@self 41 | parameters: 42 | ServiceDirectory: keyvault/azure_security_keyvault_keys 43 | PackageVersions: ${{ parameters.PackageVersions }} 44 | Tests: ${{ parameters.Tests }} 45 | Arguments: ${{ parameters.Arguments }} 46 | Iterations: ${{ parameters.Iterations }} 47 | AdditionalArguments: ${{ parameters.AdditionalArguments }} 48 | Profile: ${{ parameters.Profile }} 49 | -------------------------------------------------------------------------------- /eng/common/pipelines/templates/steps/detect-api-changes.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | ArtifactPath: $(Build.ArtifactStagingDirectory) 3 | ArtifactName: 'packages' 4 | RepoRoot: $(Build.SourcesDirectory) 5 | Condition: true 6 | 7 | steps: 8 | - ${{ if eq(variables['Build.Reason'],'PullRequest') }}: 9 | - pwsh: | 10 | $apiChangeDetectRequestUrl = "https://apiview.dev/api/PullRequests/CreateAPIRevisionIfAPIHasChanges" 11 | echo "##vso[task.setvariable variable=ApiChangeDetectRequestUrl]$apiChangeDetectRequestUrl" 12 | displayName: "Set API change detect request URL" 13 | condition: and(succeededOrFailed(), ${{ parameters.Condition}}, eq(variables['ApiChangeDetectRequestUrl'], '')) 14 | 15 | - task: Powershell@2 16 | inputs: 17 | filePath: ${{ parameters.RepoRoot }}/eng/common/scripts/Detect-Api-Changes.ps1 18 | arguments: > 19 | -ArtifactPath ${{parameters.ArtifactPath}} 20 | -CommitSha '$(System.PullRequest.SourceCommitId)' 21 | -BuildId $(Build.BuildId) 22 | -PullRequestNumber $(System.PullRequest.PullRequestNumber) 23 | -RepoFullName $(Build.Repository.Name) 24 | -APIViewUri $(ApiChangeDetectRequestUrl) 25 | -ArtifactName ${{ parameters.ArtifactName }} 26 | -DevopsProject $(System.TeamProject) 27 | pwsh: true 28 | displayName: Create APIView if API has changes 29 | condition: and(${{ parameters.Condition }}, succeededOrFailed()) 30 | -------------------------------------------------------------------------------- /sdk/identity/azure_identity/examples/azure_cli_credentials.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | use azure_core::credentials::TokenCredential; 5 | use azure_identity::AzureCliCredential; 6 | use std::error::Error; 7 | use url::Url; 8 | 9 | #[tokio::main] 10 | async fn main() -> Result<(), Box> { 11 | let subscription_id = 12 | std::env::var("AZURE_SUBSCRIPTION_ID").expect("AZURE_SUBSCRIPTION_ID required"); 13 | 14 | let credentials = AzureCliCredential::new(None)?; 15 | let res = credentials 16 | .get_token(&["https://management.azure.com/.default"], None) 17 | .await?; 18 | eprintln!("Azure CLI response == {res:?}"); 19 | 20 | // Let's enumerate the Azure storage accounts 21 | // in the subscription. Note: this way of calling the REST API 22 | // will be different (and easier) using other Azure Rust SDK 23 | // crates, this is just an example. 24 | let url = Url::parse(&format!( 25 | "https://management.azure.com/subscriptions/{subscription_id}/providers/Microsoft.Storage/storageAccounts?api-version=2019-06-01" 26 | ))?; 27 | 28 | let resp = reqwest::Client::new() 29 | .get(url) 30 | .header("Authorization", format!("Bearer {}", res.token.secret())) 31 | .send() 32 | .await? 33 | .text() 34 | .await?; 35 | 36 | println!("{resp}"); 37 | Ok(()) 38 | } 39 | --------------------------------------------------------------------------------