Skip to content

Commit 9b9f76a

Browse files
authored
Re-enable running previously disabled samples using AzureCliCredential. (#5818)
* Re-enable running KeyVault samples on Ubuntu using AzureCliCredential. * Re-enable running Attestation samples using AzureCliCredential. * Re-enable running EventHubs samples using AzureCliCredential. * Re-enable running Identity samples. * Disable client_secret_credential_sample since it depends on env vars that don't exist.
1 parent e67bcaa commit 9b9f76a

24 files changed

Lines changed: 30 additions & 38 deletions

File tree

eng/pipelines/templates/jobs/live.tests.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,14 @@ jobs:
244244
# Will run samples described on a file name [service]-samples.txt within the build directory.
245245
# For example keyvault-samples.txt.
246246
# The file is written by CMake during configuration when building samples.
247-
- task: AzurePowerShell@5
248-
displayName: "Run Samples for : ${{ parameters.ServiceDirectory }}"
247+
- task: AzureCLI@2
248+
displayName: "Run Samples with AzureCli for : ${{ parameters.ServiceDirectory }}"
249249
condition: and(succeeded(), eq(variables['RunSamples'], '1'))
250250
inputs:
251251
azureSubscription: ${{ parameters.CloudConfig.ServiceConnection }}
252-
azurePowerShellVersion: LatestVersion
253-
ScriptType: InlineScript
254-
Inline: |
255-
$account = (Get-AzContext).Account
256-
$env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id
257-
$env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants
258-
252+
scriptType: 'pscore'
253+
scriptLocation: 'inlineScript'
254+
inlineScript: |
259255
if (Test-Path -Path "${{ parameters.ServiceDirectory }}-samples.txt") {
260256
$samples = Get-Content "${{ parameters.ServiceDirectory }}-samples.txt"
261257
foreach ($sample in $samples) {
@@ -269,8 +265,8 @@ jobs:
269265
}
270266
}
271267
workingDirectory: build
268+
useGlobalConfig: true
272269
env:
273-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
274270
${{ insert }}: ${{ parameters.EnvVars }}
275271

276272
- ${{ else }}:

eng/pipelines/templates/stages/platform-matrix-live.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"CMAKE_GENERATOR_PLATFORM": "x64",
106106
"CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON -DDISABLE_PROXY_TESTS=ON ",
107107
"BuildArgs": "-v --parallel 8 --config Release",
108-
"RunSamples": 1,
109108
"WindowsCtestConfig": "-C Release"
110109
}
111110
}
@@ -142,7 +141,6 @@
142141
"CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ",
143142
"BuildArgs": "-v --parallel 8 --config Release",
144143
"AZURE_CORE_ENABLE_JSON_TESTS": 1,
145-
"RunSamples": 1,
146144
"WindowsCtestConfig": "-C Release"
147145
},
148146
"x64_with_unit_test_winHttp": {
@@ -159,7 +157,6 @@
159157
"CMAKE_GENERATOR_PLATFORM": "x64",
160158
"CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON ",
161159
"BuildArgs": "-v --parallel 8 --config Release",
162-
"RunSamples": 1,
163160
"WindowsCtestConfig": "-C Release"
164161
},
165162
"x64_with_unit_samples_libcurl": {
@@ -168,7 +165,6 @@
168165
"CMAKE_GENERATOR_PLATFORM": "x64",
169166
"CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON ",
170167
"BuildArgs": "-v --parallel 8 --config Release",
171-
"RunSamples": 1,
172168
"WindowsCtestConfig": "-C Release"
173169
}
174170
}

sdk/attestation/azure-security-attestation/samples/attestation/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ add_executable (
1515
attestation_collateral.cpp
1616
attestation_collateral.hpp)
1717

18-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation attestation-${samplename} DISABLE_RUN)
18+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation attestation-${samplename})
1919

2020
target_link_libraries(attestation-${samplename} PRIVATE azure-security-attestation get-env-helper)
2121

sdk/attestation/azure-security-attestation/samples/basic-operations/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_executable (
1212
attestation-${samplename}
1313
${samplename}.cpp)
1414

15-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation attestation-${samplename} DISABLE_RUN)
15+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation attestation-${samplename})
1616

1717
target_link_libraries(attestation-${samplename} PRIVATE azure-security-attestation azure-identity get-env-helper)
1818

sdk/attestation/azure-security-attestation/samples/policy-certificates/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ add_executable (
1414
cryptohelpers.hpp
1515
)
1616

17-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation-${samplename} attestation DISABLE_RUN)
17+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation-${samplename} attestation)
1818

1919
target_link_libraries(attestation-${samplename} PRIVATE azure-security-attestation azure-identity OpenSSL::Crypto get-env-helper)
2020

sdk/attestation/azure-security-attestation/samples/policy/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ add_executable (
1414
cryptohelpers.hpp
1515
)
1616

17-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation attestation-${samplename} DISABLE_RUN)
17+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(attestation attestation-${samplename})
1818

1919
target_link_libraries(attestation-${samplename} PRIVATE azure-security-attestation azure-identity get-env-helper)
2020

sdk/eventhubs/azure-messaging-eventhubs/samples/basic-operations/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_executable (
1212
eventhubs-${samplename}
1313
${samplename}.cpp)
1414

15-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(eventhubs eventhubs-${samplename} DISABLE_RUN)
15+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(eventhubs eventhubs-${samplename})
1616

1717
target_link_libraries(eventhubs-${samplename} PRIVATE azure-messaging-eventhubs azure-identity)
1818
endmacro()

sdk/eventhubs/azure-messaging-eventhubs/samples/consume-events/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_executable (
1212
eventhubs-${samplename}
1313
${samplename}.cpp)
1414

15-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(eventhubs eventhubs-${samplename} DISABLE_RUN)
15+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(eventhubs eventhubs-${samplename})
1616

1717
target_link_libraries(eventhubs-${samplename} PRIVATE azure-messaging-eventhubs azure-identity)
1818
endmacro()

sdk/eventhubs/azure-messaging-eventhubs/samples/produce-events/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_executable (
1212
eventhubs-${samplename}
1313
${samplename}.cpp)
1414

15-
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(eventhubs eventhubs-${samplename} DISABLE_RUN)
15+
CREATE_PER_SERVICE_TARGET_BUILD_FOR_SAMPLE(eventhubs eventhubs-${samplename})
1616

1717
target_link_libraries(eventhubs-${samplename} PRIVATE azure-messaging-eventhubs azure-identity)
1818
endmacro()

sdk/identity/azure-identity/samples/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ create_per_service_target_build_for_sample(identity client_secret_credential_sam
3939
add_executable(default_azure_credential_sample default_azure_credential.cpp)
4040
target_link_libraries(default_azure_credential_sample PRIVATE azure-identity service)
4141
target_include_directories(default_azure_credential_sample PRIVATE .)
42-
create_per_service_target_build_for_sample(identity default_azure_credential_sample DISABLE_RUN)
42+
create_per_service_target_build_for_sample(identity default_azure_credential_sample)
4343

4444
add_executable(environment_credential_sample environment_credential.cpp)
4545
target_link_libraries(environment_credential_sample PRIVATE azure-identity service)
4646
target_include_directories(environment_credential_sample PRIVATE .)
47-
create_per_service_target_build_for_sample(identity environment_credential_sample DISABLE_RUN)
47+
create_per_service_target_build_for_sample(identity environment_credential_sample)
4848

4949
add_executable(managed_identity_credential_sample managed_identity_credential.cpp)
5050
target_link_libraries(managed_identity_credential_sample PRIVATE azure-identity service)
5151
target_include_directories(managed_identity_credential_sample PRIVATE .)
52-
create_per_service_target_build_for_sample(identity managed_identity_credential_sample DISABLE_RUN)
52+
create_per_service_target_build_for_sample(identity managed_identity_credential_sample)

0 commit comments

Comments
 (0)