Skip to content

Commit b94af6d

Browse files
committed
move startupscripts to new folder and ensure they are excuted during import
1 parent 5f67d3e commit b94af6d

File tree

33 files changed

+25
-240
lines changed

33 files changed

+25
-240
lines changed

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Commands.AnalysisServices.Dataplane.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@
112112
</Compile>
113113
</ItemGroup>
114114
<ItemGroup>
115-
<None Include="AnalysisServicesDataplaneStartup.ps1">
116-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
117-
</None>
118115
<None Include="Azure.AnalysisServices.psd1">
119116
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
120117
</None>

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Commands/AddAzureASAccount.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Microsoft.Azure.Commands.AnalysisServices.Dataplane
3232
[Cmdlet("Add", "AzureAnalysisServicesAccount", DefaultParameterSetName = "UserParameterSetName", SupportsShouldProcess =true)]
3333
[Alias("Login-AzureAsAccount")]
3434
[OutputType(typeof(AsAzureProfile))]
35-
public class AddAzureASAccountCommand : AzurePSCmdlet, IModuleAssemblyInitializer
35+
public class AddAzureASAccountCommand : AzurePSCmdlet
3636
{
3737
private const string UserParameterSet = "UserParameterSetName";
3838
private const string ServicePrincipalWithPasswordParameterSet = "ServicePrincipalWithPasswordParameterSetName";
@@ -189,22 +189,5 @@ public override void ExecuteCmdlet()
189189
WriteObject(asAzureProfile);
190190
}
191191
}
192-
193-
public void OnImport()
194-
{
195-
try
196-
{
197-
System.Management.Automation.PowerShell invoker = null;
198-
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
199-
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
200-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
201-
"AnalysisServicesDataplaneStartup.ps1")));
202-
invoker.Invoke();
203-
}
204-
catch
205-
{
206-
// This will throw exception for tests, ignore.
207-
}
208-
}
209192
}
210193
}

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/AnalysisServicesDataplaneStartup.ps1 renamed to src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/StartupScripts/AnalysisServicesDataplaneStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"Login-AzureAsAccount" = "Add-AzureAnalysisServicesAccount";
1717
"Restart-AzureAsInstance" = "Restart-AzureAnalysisServicesInstance";
1818
"Sync-AzureAsInstance" = "Sync-AzureAnalysisServicesInstance";
19-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
19+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

src/ResourceManager/Cdn/AzureRM.Cdn.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ CmdletsToExport = 'Get-AzureRmCdnProfile', 'Get-AzureRmCdnProfileSsoUrl',
9191
# VariablesToExport = @()
9292

9393
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
94-
AliasesToExport = @()
94+
AliasesToExport = 'Validate-AzureRmCdnCustomDomain'
9595

9696
# DSC resources to export from this module
9797
# DscResourcesToExport = @()

src/ResourceManager/Cdn/Commands.Cdn/Commands.Cdn.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@
141141
<None Include="StartupScripts\*.ps1">
142142
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
143143
</None>
144-
<None Include="CdnStartup.ps1">
145-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
146-
</None>
147144
</ItemGroup>
148145
<ItemGroup>
149146
<EmbeddedResource Include="Properties\Resources.resx">

src/ResourceManager/Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
namespace Microsoft.Azure.Commands.Cdn.CustomDomain
3333
{
3434
[Cmdlet(VerbsCommon.New, "AzureRmCdnCustomDomain", DefaultParameterSetName = FieldsParameterSet, SupportsShouldProcess = true), OutputType(typeof(PSCustomDomain))]
35-
public class NewAzureRmCdnCustomDomain : AzureCdnCmdletBase, IModuleAssemblyInitializer
35+
public class NewAzureRmCdnCustomDomain : AzureCdnCmdletBase
3636
{
3737
[Parameter(Mandatory = true, HelpMessage = "Host name (address) of the Azure CDN custom domain name.")]
3838
[ValidateNotNullOrEmpty]
@@ -99,22 +99,5 @@ private void NewCustomDomain()
9999
WriteVerbose(Resources.Success);
100100
WriteObject(customDomain.ToPsCustomDomain());
101101
}
102-
103-
public void OnImport()
104-
{
105-
try
106-
{
107-
System.Management.Automation.PowerShell invoker = null;
108-
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
109-
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
110-
Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory),
111-
"CdnStartup.ps1")));
112-
invoker.Invoke();
113-
}
114-
catch
115-
{
116-
// This may throw exception for tests, ignore.
117-
}
118-
}
119102
}
120103
}

src/ResourceManager/Cdn/Commands.Cdn/CdnStartup.ps1 renamed to src/ResourceManager/Cdn/Commands.Cdn/StartupScripts/CdnStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
@{
1616
"Validate-AzureRmCdnCustomDomain" = "Test-AzureRmCdnCustomDomain";
17-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
17+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@
111111
<Link>AzureRM.HDInsight.psd1</Link>
112112
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
113113
</None>
114-
<None Include="AzureRmHDInsightStartup.ps1">
115-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
116-
</None>
117114
<None Include="Microsoft.Azure.Commands.HDInsight.dll-help.psd1">
118115
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
119116
</None>

src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/EnableAzureHDInsightOMSCommand.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.HDInsight
2828
SupportsShouldProcess = true)]
2929
[Alias("Enable-AzureRmHDInsightOMS")]
3030
[OutputType(typeof(OperationResource))]
31-
public class EnableAzureHDInsightOMSCommand : HDInsightCmdletBase, IModuleAssemblyInitializer
31+
public class EnableAzureHDInsightOMSCommand : HDInsightCmdletBase
3232
{
3333
#region Input Parameter Definitions
3434

@@ -79,25 +79,5 @@ public override void ExecuteCmdlet()
7979
WriteObject(operationResource);
8080
}
8181
}
82-
83-
/// <summary>
84-
/// Load global aliases for HDInsight
85-
/// </summary>
86-
public void OnImport()
87-
{
88-
try
89-
{
90-
System.Management.Automation.PowerShell invoker = null;
91-
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
92-
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
93-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
94-
"AzureRmHDInsightStartup.ps1")));
95-
invoker.Invoke();
96-
}
97-
catch
98-
{
99-
// This may throw exception for tests, ignore.
100-
}
101-
}
10282
}
10383
}

src/ResourceManager/HDInsight/Commands.HDInsight/AzureRmHDInsightStartup.ps1 renamed to src/ResourceManager/HDInsight/Commands.HDInsight/StartupScripts/AzureRmHDInsightStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"Enable-AzureRmHDInsightOMS" = "Enable-AzureRmHDInsightOperationsManagementSuite";
1717
"Disable-AzureRmHDInsightOMS" = "Disable-AzureRmHDInsightOperationsManagementSuite";
1818
"Get-AzureRmHDInsightOMS" = "Get-AzureRmHDInsightOperationsManagementSuite";
19-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
19+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

src/ResourceManager/Network/Commands.Network/ApplicationGateway/GetAzureApplicationGatewayAvailableWafRuleSets.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.Network
2727
[Cmdlet(VerbsCommon.Get, "AzureRmApplicationGatewayAvailableWafRuleSets"),
2828
OutputType(typeof(PSApplicationGatewayAvailableWafRuleSetsResult))]
2929
[Alias("List-AzureRmApplicationGatewayAvailableWafRuleSets")]
30-
public class GetAzureApplicationGatewayAvailableWafRuleSets : ApplicationGatewayBaseCmdlet, IModuleAssemblyInitializer
30+
public class GetAzureApplicationGatewayAvailableWafRuleSets : ApplicationGatewayBaseCmdlet
3131
{
3232
public override void ExecuteCmdlet()
3333
{
@@ -37,26 +37,6 @@ public override void ExecuteCmdlet()
3737
var psAvailableWafRuleSets = NetworkResourceManagerProfile.Mapper.Map<PSApplicationGatewayAvailableWafRuleSetsResult>(availableWafRuleSets);
3838
WriteObject(psAvailableWafRuleSets);
3939
}
40-
41-
/// <summary>
42-
/// Setup necessary functionality when module gets imported.
43-
/// </summary>
44-
public void OnImport()
45-
{
46-
try
47-
{
48-
System.Management.Automation.PowerShell invoker = null;
49-
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
50-
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
51-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
52-
"AzureRmNetworkStartup.ps1")));
53-
invoker.Invoke();
54-
}
55-
catch
56-
{
57-
// This will throw exception for tests, ignore.
58-
}
59-
}
6040
}
6141
}
6242

src/ResourceManager/Network/Commands.Network/Commands.Network.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,6 @@
567567
<Link>AzureRM.Network.psd1</Link>
568568
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
569569
</None>
570-
<None Include="AzureRmNetworkStartup.ps1">
571-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
572-
</None>
573570
<None Include="Microsoft.Azure.Commands.Network.dll-Help.psd1">
574571
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
575572
</None>

src/ResourceManager/Network/Commands.Network/AzureRmNetworkStartup.ps1 renamed to src/ResourceManager/Network/Commands.Network/StartupScripts/AzureRmNetworkStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"List-AzureRmApplicationGatewayAvailableWafRuleSets" = "Get-AzureRmApplicationGatewayAvailableWafRuleSets"
1717
"List-AzureRmApplicationGatewayAvailableSslOptions" = "Get-AzureRmApplicationGatewayAvailableSslOptions"
1818
"List-AzureRmApplicationGatewaySslPredefinedPolicy" = "Get-AzureRmApplicationGatewaySslPredefinedPolicy"
19-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
19+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@
164164
<SubType>Designer</SubType>
165165
</Content>
166166
<None Include="MSSharedLibKey.snk" />
167-
<Content Include="OperationalInsightsStartup.ps1">
168-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
169-
</Content>
170167
<None Include="packages.config">
171168
<SubType>Designer</SubType>
172169
</None>

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/DataSources/NewDataSourceCmdletsPerKind/NewAzureOperationalInsightsAzureActivityLogDataSourceCommand.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.OperationalInsights
2929
[Cmdlet(VerbsCommon.New, "AzureRmOperationalInsightsAzureActivityLogDataSource", SupportsShouldProcess = true,
3030
DefaultParameterSetName = ByWorkspaceName), OutputType(typeof(PSDataSource))]
3131
[Alias("New-AzureRmOperationalInsightsAzureAuditDataSource")]
32-
public class NewAzureOperationalInsightsAzureActivityLogDataSourceCommand : NewAzureOperationalInsightsDataSourceBaseCmdlet, IModuleAssemblyInitializer
32+
public class NewAzureOperationalInsightsAzureActivityLogDataSourceCommand : NewAzureOperationalInsightsDataSourceBaseCmdlet
3333
{
3434
[Parameter(Position = 0, ParameterSetName = ByWorkspaceObject, Mandatory = true, ValueFromPipeline = true,
3535
HelpMessage = "The workspace that will contain the data source.")]
@@ -74,27 +74,5 @@ public override void ExecuteCmdlet()
7474

7575
CreatePSDataSourceWithProperties(auditLogProperties);
7676
}
77-
78-
79-
/// <summary>
80-
/// Load global aliases for ARM
81-
/// </summary>
82-
public void OnImport()
83-
{
84-
try
85-
{
86-
System.Management.Automation.PowerShell invoker = null;
87-
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
88-
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
89-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
90-
"OperationalInsightsStartup.ps1")));
91-
invoker.Invoke();
92-
}
93-
catch
94-
{
95-
// This will throw exception for tests, ignore.
96-
}
97-
98-
}
9977
}
10078
}

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/OperationalInsightsStartup.ps1 renamed to src/ResourceManager/OperationalInsights/Commands.OperationalInsights/StartupScripts/OperationalInsightsStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
@{
1616
"New-AzureRmOperationalInsightsAzureAuditDataSource" = "New-AzureRmOperationalInsightsAzureActivityLogDataSource";
17-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
17+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

src/ResourceManager/Profile/AzureRM.Profile.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ CmdletsToExport = 'Disable-AzureRmDataCollection', 'Disable-AzureRmContextAutosa
113113
# VariablesToExport = @()
114114

115115
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
116-
AliasesToExport = 'Login-AzureRmAccount', 'Select-AzureRmSubscription', 'Resolve-Error',
117-
'Logout-AzAccount', 'Logout-AzureRmAccount', 'Login-AzAccount'
116+
AliasesToExport = 'Login-AzureRmAccount', 'Select-AzureRmSubscription', 'Save-AzureRmProfile', 'Resolve-Error',
117+
'Logout-AzAccount', 'Logout-AzureRmAccount', 'Login-AzAccount', 'Select-AzureRmProfile'
118118

119119
# DSC resources to export from this module
120120
# DscResourcesToExport = @()

src/ResourceManager/Profile/Commands.Profile/Account/AddAzureRmAccount.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ public void OnImport()
266266
#if DEBUG
267267
}
268268
#endif
269-
var invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
270-
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
271-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
272-
"AzureRmProfileStartup.ps1")));
273-
var result = invoker.Invoke();
274269

275270
bool autoSaveEnabled = AzureSession.Instance.ARMContextSaveMode == ContextSaveMode.CurrentUser;
276271
var autosaveVariable = System.Environment.GetEnvironmentVariable(AzureProfileConstants.AzureAutosaveVariable);

src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@
127127
<Link>AzureRM.Profile.psd1</Link>
128128
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
129129
</None>
130-
<None Include="AzureRmProfileStartup.ps1">
131-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
132-
</None>
133130
<Content Include="Microsoft.Azure.Commands.Profile.types.ps1xml">
134131
<SubType>Designer</SubType>
135132
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

src/ResourceManager/Profile/Commands.Profile/AzureRmProfileStartup.ps1 renamed to src/ResourceManager/Profile/Commands.Profile/StartupScripts/AzureRmProfileStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"Logout-AzAccount" = "Remove-AzureRmAccount";
2222
"Logout-AzureRmAccount" = "Remove-AzureRmAccount";
2323
"Login-AzAccount" = "Add-AzureRmAccount";
24-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias" | Out-Null
24+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias" | Out-Null
2525

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@
168168
<None Include="StartupScripts\*.ps1">
169169
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
170170
</None>
171-
<None Include="RecoveryServicesAsrStartup.ps1">
172-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
173-
</None>
174171
</ItemGroup>
175172
<ItemGroup>
176173
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication.Abstractions\Commands.Common.Authentication.Abstractions.csproj">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@
8787
"Update-ASRRecoveryPlan" = "Update-AzureRmRecoveryServicesAsrRecoveryPlan";
8888
"Update-ASRServicesProvider" = "Update-AzureRmRecoveryServicesAsrServicesProvider";
8989
"Update-ASRvCenter" = "Update-AzureRmRecoveryServicesAsrvCenter";
90-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
90+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

src/ResourceManager/RecoveryServices.SiteRecovery/Commands.RecoveryServices.SiteRecovery/Storage/Classification/RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping.cs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.SiteRecovery
3333
[Alias("Remove-ASRStorageClassificationMapping")]
3434
[OutputType(typeof(ASRJob))]
3535
public class RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping :
36-
SiteRecoveryCmdletBase,
37-
IModuleAssemblyInitializer
36+
SiteRecoveryCmdletBase
3837
{
3938
/// <summary>
4039
/// Gets or sets primary storage classification.
@@ -47,34 +46,6 @@ public class RemoveAzureRmRecoveryServicesAsrStorageClassificationMapping :
4746
[Alias("StorageClassificationMapping")]
4847
public ASRStorageClassificationMapping InputObject { get; set; }
4948

50-
/// <summary>
51-
/// Add Site Recovery aliases
52-
/// </summary>
53-
public void OnImport()
54-
{
55-
try
56-
{
57-
AzureSessionInitializer.InitializeAzureSession();
58-
ResourceManagerProfileProvider.InitializeResourceManagerProfile();
59-
60-
System.Management.Automation.PowerShell invoker = null;
61-
invoker = System.Management.Automation.PowerShell.Create(
62-
RunspaceMode.CurrentRunspace);
63-
invoker.AddScript(
64-
File.ReadAllText(
65-
FileUtilities.GetContentFilePath(
66-
Path.GetDirectoryName(
67-
Assembly.GetExecutingAssembly()
68-
.Location),
69-
"RecoveryServicesAsrStartup.ps1")));
70-
invoker.Invoke();
71-
}
72-
catch
73-
{
74-
// This may throw exception for tests, ignore.
75-
}
76-
}
77-
7849
/// <summary>
7950
/// ProcessRecord of the command.
8051
/// </summary>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@
8585
<Link>AzureRM.RecoveryServices.psd1</Link>
8686
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8787
</None>
88-
<None Include="AzureRmRecoveryServicesStartup.ps1">
89-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
90-
</None>
9188
<None Include="MSSharedLibKey.snk" />
9289
<None Include="packages.config">
9390
<SubType>Designer</SubType>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/AzureRmRecoveryServicesStartup.ps1 renamed to src/ResourceManager/RecoveryServices/Commands.RecoveryServices/StartupScripts/AzureRmRecoveryServicesStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
@{
1616
"Get-AzureRmRecoveryServicesBackupProperty" = "Get-AzureRmRecoveryServicesBackupProperties";
17-
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
17+
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | Set-Alias -Description "AzureAlias"

0 commit comments

Comments
 (0)