Skip to content

Commit b605d92

Browse files
committed
Conslidate DTS logic
1 parent b3e9c40 commit b605d92

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/commands/appSettings/connectionSettings/durableTaskScheduler/DTSConnectionSetSettingStep.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { CodeAction, ConnectionKey, hostFileName } from '../../../../constants';
99
import { ext } from '../../../../extensionVariables';
1010
import { type IDTSTaskJson, type IHostJsonV2 } from '../../../../funcConfig/host';
1111
import { localize } from '../../../../localize';
12-
import { clientIdKey } from '../../../durableTaskScheduler/copySchedulerConnectionString';
1312
import { notifyFailedToConfigureHost } from '../notifyFailedToConfigureHost';
1413
import { setLocalSetting } from '../setConnectionSetting';
1514
import { type IDTSAzureConnectionWizardContext, type IDTSConnectionWizardContext } from './IDTSConnectionWizardContext';
@@ -37,12 +36,7 @@ export class DTSConnectionSetSettingStep<T extends IDTSConnectionWizardContext |
3736
}
3837

3938
const newDTSConnectionSettingKey = nonNullProp(context, 'newDTSConnectionSettingKey');
40-
let newDTSConnectionSettingValue = nonNullProp(context, 'newDTSConnectionSettingValue');
41-
42-
// Todo: Move this to `DurableTaskSchedulerGetConnectionStep` when we upgrade the azure package for new identity logic
43-
if ((context as IDTSAzureConnectionWizardContext).managedIdentity) {
44-
newDTSConnectionSettingValue = newDTSConnectionSettingValue.replace(clientIdKey, (context as IDTSAzureConnectionWizardContext).managedIdentity?.clientId ?? clientIdKey);
45-
}
39+
const newDTSConnectionSettingValue = nonNullProp(context, 'newDTSConnectionSettingValue');
4640

4741
if (context.action === CodeAction.Debug) {
4842
await setLocalSetting(context, newDTSConnectionSettingKey, newDTSConnectionSettingValue);

src/commands/appSettings/connectionSettings/durableTaskScheduler/azure/DurableTaskSchedulerGetConnectionStep.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { AzureWizardExecuteStep } from '@microsoft/vscode-azext-utils';
7-
import { getSchedulerConnectionString, SchedulerAuthenticationType } from '../../../../durableTaskScheduler/copySchedulerConnectionString';
7+
import { clientIdKey, getSchedulerConnectionString, SchedulerAuthenticationType } from '../../../../durableTaskScheduler/copySchedulerConnectionString';
88
import { type IDTSAzureConnectionWizardContext } from '../IDTSConnectionWizardContext';
99

1010
export class DurableTaskSchedulerGetConnectionStep<T extends IDTSAzureConnectionWizardContext> extends AzureWizardExecuteStep<T> {
1111
public priority: number = 200;
1212

1313
public async execute(context: T): Promise<void> {
1414
context.newDTSConnectionSettingValue = getSchedulerConnectionString(context.dts?.properties.endpoint ?? '', SchedulerAuthenticationType.UserAssignedIdentity);
15+
16+
if (context.managedIdentity) {
17+
context.newDTSConnectionSettingValue = context.newDTSConnectionSettingValue.replace(clientIdKey, (context as IDTSAzureConnectionWizardContext).managedIdentity?.clientId ?? clientIdKey);
18+
}
19+
1520
context.valuesToMask.push(context.newDTSConnectionSettingValue);
1621
}
1722

0 commit comments

Comments
 (0)