diff --git a/powershell/module/module-class.ts b/powershell/module/module-class.ts index ffef6105f55..1c552107e1b 100644 --- a/powershell/module/module-class.ts +++ b/powershell/module/module-class.ts @@ -335,9 +335,9 @@ export class NewModuleClass extends Class { const ArgumentCompleter = this.add(new Property('ArgumentCompleter', argumentCompleterDelegate, { description: 'Gets completion data for azure specific fields' })); const ProfileName = this.add(new Property('ProfileName', System.String, { description: 'The name of the currently selected Azure profile' })); - const moduleIdentity = this.add(new LambdaProperty('Name', dotnet.String, new StringExpression(this.state.project.moduleName), { description: 'The Name of this module ' })); + const moduleIdentity = this.add(new LambdaProperty('Name', dotnet.String, new StringExpression((this.state.project.rootModuleName ?? '').length === 0 ? this.state.project.moduleName : this.state.project.rootModuleName), { description: 'The Name of this module ' })); const currentProfile = this.add(new Field('Profile', dotnet.String, { initialValue: System.String.Empty, description: 'The currently selected profile.' })); - const moduleResourceId = this.add(new LambdaProperty('ResourceId', dotnet.String, new StringExpression(this.state.project.moduleName), { description: 'The ResourceID for this module (azure arm).' })); + const moduleResourceId = this.add(new LambdaProperty('ResourceId', dotnet.String, new StringExpression((this.state.project.rootModuleName ?? '').length === 0 ? this.state.project.moduleName : this.state.project.rootModuleName), { description: 'The ResourceID for this module (azure arm).' })); /* get parameter method (calls azAccounts) */ this.add(new LambdaMethod('GetParameter', dotnet.Object, new LiteralExpression(`${GetParameterValue.value}?.Invoke( ${moduleResourceId.value}, ${moduleIdentity.value}, ${$this.pInvocationInfo.value}, ${$this.pCorrelationId.value},${$this.pParameterName.value} )`), {