Skip to content

Commit a5b1a86

Browse files
committed
Make v1.0 the default profile.
1 parent 4f39de6 commit a5b1a86

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/Authentication/Authentication/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ public static class Constants
1616
internal static readonly string TokenCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".graph");
1717
internal const string ProfileDescription = "A snapshot of the Microsoft Graph {0} API for {1} cloud.";
1818
internal const string TokenCacheServiceName = "com.microsoft.graph.powershell.sdkcache";
19-
internal const string DefaultProfile = "v1.0-beta";
19+
internal const string DefaultProfile = "v1.0";
2020
}
2121
}

tools/Custom/Module.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public partial class Module
2424
/// <summary>
2525
/// The selected Microsoft Graph profile.
2626
/// </summary>
27-
public string ProfileName { get; set; } = "v1.0-beta";
27+
public string ProfileName { get; set; } = "v1.0";
2828
partial void BeforeCreatePipeline(System.Management.Automation.InvocationInfo invocationInfo, ref Runtime.HttpPipeline pipeline)
2929
{
3030
// Call Init to trigger any custom initialization needed after

tools/GenerateModules.ps1

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,22 +127,37 @@ $ModuleMapping.Keys | ForEach-Object -Begin { $RequestCount = 0 } -End { Write-H
127127
[HashTable]$PrivateData = @{ Profiles = $Profiles }
128128
Update-ModuleManifest -Path $ModuleManifestPath -PrivateData $PrivateData
129129

130-
# Update module psm1 with Graph session profile name.
130+
# Update main module psm1.
131131
$ModulePsm1 = Join-Path $ModuleProjectDir "/$ModulePrefix.$ModuleName.psm1"
132132
(Get-Content -Path $ModulePsm1) | ForEach-Object{
133-
$_
134133
if ($_ -match '\$instance = \[Microsoft.Graph.PowerShell.Module\]::Instance') {
134+
# Update main psm1 with Graph session profile name and module name.
135+
$_
135136
' $instance.ProfileName = [Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance.SelectedProfile'
137+
} else {
138+
# Rename all Azure instances in psm1 to `Microsoft Graph`.
139+
$updatedLine = $_ -replace 'Azure', 'Microsoft Graph'
140+
# Replace all 'instance.Name' declarations with fully qualified module name.
141+
$updatedLine = $updatedLine -replace '\$\(\$instance.Name\)', "$ModulePrefix.$ModuleName"
142+
$updatedLine
136143
}
137144
} | Set-Content $ModulePsm1
138145

139-
# Address AutoREST bug where it looks for exports in the wrong directory.
146+
# Update internal module psm1.
140147
$InternalModulePsm1 = Join-Path $ModuleProjectDir "/internal/$ModulePrefix.$ModuleName.internal.psm1"
141148
(Get-Content -Path $InternalModulePsm1) | ForEach-Object{
142-
$_
149+
$updatedLine = $_
150+
# Address AutoREST bug where it looks for exports in the wrong directory.
143151
if ($_ -match '\$exportsPath = \$PSScriptRoot') {
144-
' $exportsPath = Join-Path $PSScriptRoot "../exports"'
152+
$updatedLine = ' $exportsPath = Join-Path $PSScriptRoot "../exports"'
145153
}
154+
155+
# Remove duplicate instance.Name declarations in internal.psm1
156+
# Main .psm1 already handles this.
157+
if ($_ -match '\$\(\$instance.Name\)') {
158+
$updatedLine = ""
159+
}
160+
$updatedLine
146161
} | Set-Content $InternalModulePsm1
147162

148163
if ($LASTEXITCODE) {

0 commit comments

Comments
 (0)