Skip to content

Commit 4e5b718

Browse files
authored
[HanaOnAzure] Fix issue in powershell <7 (#12685)
* fix hana * fix doc link
1 parent ef6a2ae commit 4e5b718

File tree

10 files changed

+163
-50
lines changed

10 files changed

+163
-50
lines changed
Lines changed: 132 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,135 @@
1+
#
2+
# Module manifest for module 'Az.HanaOnAzure'
3+
#
4+
# Generated by: Microsoft Corporation
5+
#
6+
# Generated on: 2020/8/18
7+
#
8+
19
@{
2-
GUID = '79ad50da-e6b5-4703-885a-d36974a4d9b9'
3-
RootModule = './Az.HanaOnAzure.psm1'
4-
ModuleVersion = '0.1.0'
5-
CompatiblePSEditions = 'Core', 'Desktop'
6-
Author = 'Microsoft Corporation'
7-
CompanyName = 'Microsoft Corporation'
8-
Copyright = 'Microsoft Corporation. All rights reserved.'
9-
Description = 'Microsoft Azure PowerShell: HanaOn cmdlets'
10-
PowerShellVersion = '5.1'
11-
DotNetFrameworkVersion = '4.7.2'
12-
RequiredAssemblies = './bin/Az.HanaOnAzure.private.dll'
13-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.9.2'; })
14-
FormatsToProcess = './Az.HanaOnAzure.format.ps1xml'
15-
FunctionsToExport = 'Get-AzSapMonitor', 'Get-AzSapMonitorProviderInstance', 'New-AzSapMonitor', 'New-AzSapMonitorProviderInstance', 'Remove-AzSapMonitor', 'Remove-AzSapMonitorProviderInstance', 'Update-AzSapMonitor'
16-
AliasesToExport = '*'
17-
PrivateData = @{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = './Az.HanaOnAzure.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '0.1.0'
16+
17+
# Supported PSEditions
18+
CompatiblePSEditions = 'Core', 'Desktop'
19+
20+
# ID used to uniquely identify this module
21+
GUID = '79ad50da-e6b5-4703-885a-d36974a4d9b9'
22+
23+
# Author of this module
24+
Author = 'Microsoft Corporation'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'Microsoft Corporation'
28+
29+
# Copyright statement for this module
30+
Copyright = 'Microsoft Corporation. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
Description = 'Microsoft Azure PowerShell: HanaOn cmdlets'
34+
35+
# Minimum version of the PowerShell engine required by this module
36+
PowerShellVersion = '5.1'
37+
38+
# Name of the PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
DotNetFrameworkVersion = '4.7.2'
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# ClrVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.9.2'; })
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
RequiredAssemblies = './bin/Az.HanaOnAzure.private.dll'
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
FormatsToProcess = './Az.HanaOnAzure.format.ps1xml'
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions 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 functions to export.
72+
FunctionsToExport = 'Get-AzSapMonitor', 'Get-AzSapMonitorProviderInstance',
73+
'New-AzSapMonitor', 'New-AzSapMonitorProviderInstance',
74+
'Remove-AzSapMonitor', 'Remove-AzSapMonitorProviderInstance',
75+
'Update-AzSapMonitor'
76+
77+
# Cmdlets 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 cmdlets to export.
78+
CmdletsToExport = @()
79+
80+
# Variables to export from this module
81+
# VariablesToExport = @()
82+
83+
# 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.
84+
AliasesToExport = '*'
85+
86+
# DSC resources to export from this module
87+
# DscResourcesToExport = @()
88+
89+
# List of all modules packaged with this module
90+
# ModuleList = @()
91+
92+
# List of all files packaged with this module
93+
# FileList = @()
94+
95+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
96+
PrivateData = @{
97+
1898
PSData = @{
19-
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'HanaOn'
20-
LicenseUri = 'https://aka.ms/azps-license'
21-
ProjectUri = 'https://github.com/Azure/azure-powershell'
22-
ReleaseNotes = '* the first preview release'
23-
}
24-
}
99+
100+
# Tags applied to this module. These help with module discovery in online galleries.
101+
Tags = 'Azure','ResourceManager','ARM','PSModule','HanaOn'
102+
103+
# A URL to the license for this module.
104+
LicenseUri = 'https://aka.ms/azps-license'
105+
106+
# A URL to the main website for this project.
107+
ProjectUri = 'https://github.com/Azure/azure-powershell'
108+
109+
# A URL to an icon representing this module.
110+
# IconUri = ''
111+
112+
# ReleaseNotes of this module
113+
# ReleaseNotes = ''
114+
115+
# Prerelease string of this module
116+
# Prerelease = ''
117+
118+
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
119+
# RequireLicenseAcceptance = $false
120+
121+
# External dependent modules of this module
122+
# ExternalModuleDependencies = @()
123+
124+
} # End of PSData hashtable
125+
126+
} # End of PrivateData hashtable
127+
128+
# HelpInfo URI of this module
129+
# HelpInfoURI = ''
130+
131+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
132+
# DefaultCommandPrefix = ''
133+
25134
}
135+

src/HanaOnAzure/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed an issue in PowerShell prior to 7.0
2122

2223
## Version 0.1.0
2324
* the first preview release

src/HanaOnAzure/custom/New-AzSapMonitorProviderInstance.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ function New-AzSapMonitorProviderInstance {
203203
hanaDbName = $HanaDatabaseName
204204
hanaDbSqlPort = $HanaDatabaseSqlPort
205205
hanaDbUsername = $HanaDatabaseUsername
206-
hanaDbPassword = ConvertFrom-SecureString $HanaDatabasePassword -AsPlainText
206+
# cannot use `ConvertFrom-SecureString -AsPlainText`, requires powershell >= 7
207+
hanaDbPassword = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($HanaDatabasePassword))
207208
}
208209
}
209210
'ByKeyVault' {

src/HanaOnAzure/examples/New-AzSapMonitor.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ westus2 ps-sapmonitor-t01 Microsoft.HanaOnAzure/sapMonitors
1010
```
1111

1212
This command creates a SAP monitor.
13+

src/HanaOnAzure/exports/New-AzSapMonitor.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Creates a SAP monitor for the specified subscription, resource group, and resour
1919
.Description
2020
Creates a SAP monitor for the specified subscription, resource group, and resource name.
2121
.Example
22-
PS C:\> $workspace = New-AzOperationalInsightsWorkspace -ResourceGroupName nancyc-hn1 -Name sapmonitor-test -Location westus2 -Sku "Standard"
23-
PS C:\> $workspace = Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName nancyc-hn1 -Name sapmonitor-test
24-
PS C:\> New-AzSapMonitor -Name ps-sapmonitor-t01 -ResourceGroupName nancyc-hn1 -Location westus2 -EnableCustomerAnalytic -MonitorSubnet "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/nancyc-hn1/providers/Microsoft.Network/virtualNetworks/vnet-sap/subnets/subnet-admin" -LogAnalyticsWorkspaceSharedKey $workspace.PrimarySharedKey -LogAnalyticsWorkspaceId $workspace.CustomerId -LogAnalyticsWorkspaceResourceId $workspace.ResourceId
22+
PS C:\> $Workspace = New-AzOperationalInsightsWorkspace -ResourceGroupName nancyc-hn1 -Name sapmonitor-test -Location westus2 -Sku "Standard"
23+
PS C:\> $WorkspaceKey = Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName nancyc-hn1 -Name sapmonitor-test
24+
PS C:\> New-AzSapMonitor -Name ps-sapmonitor-t01 -ResourceGroupName nancyc-hn1 -Location westus2 -EnableCustomerAnalytic -MonitorSubnet "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/nancyc-hn1/providers/Microsoft.Network/virtualNetworks/vnet-sap/subnets/subnet-admin" -LogAnalyticsWorkspaceSharedKey $WorkspaceKey.PrimarySharedKey -LogAnalyticsWorkspaceId $Workspace.CustomerId -LogAnalyticsWorkspaceResourceId $Workspace.ResourceId
2525
2626
Location Name Type
2727
-------- ---- ----

src/HanaOnAzure/exports/ProxyCmdletDefinitions.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ Creates a SAP monitor for the specified subscription, resource group, and resour
409409
.Description
410410
Creates a SAP monitor for the specified subscription, resource group, and resource name.
411411
.Example
412-
PS C:\> $workspace = New-AzOperationalInsightsWorkspace -ResourceGroupName nancyc-hn1 -Name sapmonitor-test -Location westus2 -Sku "Standard"
413-
PS C:\> $workspace = Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName nancyc-hn1 -Name sapmonitor-test
414-
PS C:\> New-AzSapMonitor -Name ps-sapmonitor-t01 -ResourceGroupName nancyc-hn1 -Location westus2 -EnableCustomerAnalytic -MonitorSubnet "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/nancyc-hn1/providers/Microsoft.Network/virtualNetworks/vnet-sap/subnets/subnet-admin" -LogAnalyticsWorkspaceSharedKey $workspace.PrimarySharedKey -LogAnalyticsWorkspaceId $workspace.CustomerId -LogAnalyticsWorkspaceResourceId $workspace.ResourceId
412+
PS C:\> $Workspace = New-AzOperationalInsightsWorkspace -ResourceGroupName nancyc-hn1 -Name sapmonitor-test -Location westus2 -Sku "Standard"
413+
PS C:\> $WorkspaceKey = Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName nancyc-hn1 -Name sapmonitor-test
414+
PS C:\> New-AzSapMonitor -Name ps-sapmonitor-t01 -ResourceGroupName nancyc-hn1 -Location westus2 -EnableCustomerAnalytic -MonitorSubnet "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/nancyc-hn1/providers/Microsoft.Network/virtualNetworks/vnet-sap/subnets/subnet-admin" -LogAnalyticsWorkspaceSharedKey $WorkspaceKey.PrimarySharedKey -LogAnalyticsWorkspaceId $Workspace.CustomerId -LogAnalyticsWorkspaceResourceId $Workspace.ResourceId
415415
416416
Location Name Type
417417
-------- ---- ----

0 commit comments

Comments
 (0)