Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into witemple-msft/rollup2
Browse files Browse the repository at this point in the history
  • Loading branch information
witemple-msft committed Jan 21, 2022
2 parents cc7f212 + 2144ad4 commit 81a9d6d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
20 changes: 13 additions & 7 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ param (
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $ProvisionerApplicationId,

[Parameter(ParameterSetName = 'Provisioner', Mandatory = $false)]
[ValidatePattern('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')]
[string] $ProvisionerApplicationOid,

[Parameter(ParameterSetName = 'Provisioner', Mandatory = $true)]
[string] $ProvisionerApplicationSecret,

Expand Down Expand Up @@ -155,7 +159,7 @@ function NewServicePrincipalWrapper([string]$subscription, [string]$resourceGrou
$appId = $servicePrincipal.AppId
} else {
Write-Verbose "Creating service principal credential via MS Graph API"
# In 7.1.0 the password credential issue was fixed (see https://github.com/Azure/azure-powershell/pull/16690) but the
# In 5.2.0 the password credential issue was fixed (see https://github.com/Azure/azure-powershell/pull/16690) but the
# parameter set was changed making the above call fail due to a missing ServicePrincipalId parameter.
$credential = Retry { $servicePrincipal | New-AzADSpCredential }
$spPassword = ConvertTo-SecureString $credential.SecretText -AsPlainText -Force
Expand Down Expand Up @@ -481,19 +485,19 @@ try {
$context = Get-AzContext;

# Make sure the provisioner OID is set so we can pass it through to the deployment.
$provisionerApplicationOid = if (!$ProvisionerApplicationId) {
if (!$ProvisionerApplicationId -and !$ProvisionerApplicationOid) {
if ($context.Account.Type -eq 'User') {
$user = Get-AzADUser -UserPrincipalName $context.Account.Id
$user.Id
$ProvisionerApplicationOid = $user.Id
} elseif ($context.Account.Type -eq 'ServicePrincipal') {
$sp = Get-AzADServicePrincipal -ApplicationId $context.Account.Id
$sp.Id
$ProvisionerApplicationOid = $sp.Id
} else {
Write-Warning "Getting the OID for provisioner type '$($context.Account.Type)' is not supported and will not be passed to deployments (seldom required)."
}
} else {
} elseif (!$ProvisionerApplicationOid) {
$sp = Get-AzADServicePrincipal -ApplicationId $ProvisionerApplicationId
$sp.Id
$ProvisionerApplicationOid = $sp.Id
}

# If the ServiceDirectory has multiple segments use the last directory name
Expand Down Expand Up @@ -651,7 +655,9 @@ try {
baseName = $BaseName
testApplicationId = $TestApplicationId
testApplicationOid = "$TestApplicationOid"
provisionerApplicationOid = "$provisionerApplicationOid"
}
if ($ProvisionerApplicationOid) {
$templateParameters["provisionerApplicationOid"] = "$ProvisionerApplicationOid"
}

if ($TenantId) {
Expand Down
2 changes: 1 addition & 1 deletion eng/common/testproxy/docker-start-proxy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ catch {
Write-Error "Please check your docker invocation and try running the script again."
}

$SELECTED_IMAGE_TAG = "1294199"
$SELECTED_IMAGE_TAG = "1314089"
$CONTAINER_NAME = "ambitious_azsdk_test_proxy"
$LINUX_IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-lin:${SELECTED_IMAGE_TAG}"
$WINDOWS_IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-win:${SELECTED_IMAGE_TAG}"
Expand Down
2 changes: 1 addition & 1 deletion eng/common/testproxy/test-proxy-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
dotnet tool install azure.sdk.tools.testproxy `
--tool-path $(Build.BinariesDirectory)/test-proxy `
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `
--version 1.0.0-dev.20220113.1
--version 1.0.0-dev.20220119.2
displayName: "Install test-proxy"
- pwsh: |
Expand Down
1 change: 1 addition & 0 deletions sdk/core/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: core
TestProxy: true
Artifacts:
- name: azure-abort-controller
safeName: azureabortcontroller
Expand Down
2 changes: 1 addition & 1 deletion sdk/test-utils/recorder/src/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class Recorder {
private _createRecordingRequest(url: string, method: HttpMethods = "POST") {
const req = createPipelineRequest({ url, method });
if (ensureExistence(this.sessionFile, "sessionFile")) {
req.headers.set("x-recording-file", this.sessionFile);
req.body = JSON.stringify({ "x-recording-file": this.sessionFile });
}
if (this.recordingId !== undefined) {
req.headers.set("x-recording-id", this.recordingId);
Expand Down
2 changes: 1 addition & 1 deletion sdk/test-utils/recorder/test/testProxyClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe("TestProxyClient functions", () => {
const returnedRequest = client["_createRecordingRequest"](initialRequest.url);
expect(returnedRequest.url).to.equal(initialRequest.url);
expect(returnedRequest.method).to.equal("POST");
expect(returnedRequest.headers.get("x-recording-file")).not.to.be.undefined;
expect(returnedRequest.body).not.to.be.undefined;
expect(returnedRequest.headers.get("x-recording-id")).to.equal(client.recordingId);
expect(returnedRequest.url).to.equal(initialRequest.url);
});
Expand Down

0 comments on commit 81a9d6d

Please sign in to comment.