Skip to content

Commit 0bce9aa

Browse files
authored
Merge branch 'main' into cplat-SIGCMKBug
2 parents d7827b2 + 89dabd8 commit 0bce9aa

File tree

11 files changed

+3097
-14
lines changed

11 files changed

+3097
-14
lines changed

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
-->
2222
## Upcoming Release
2323
* Update New-AzGalleryImageVersion to take in the 'Encryption' property correctly from '-TagetRegion' parameter.
24+
* Update Set-AzVmBootDiagnostic to default to managed storage account if not provided.
2425
* Update Compute .NET SDK package reference to version 49.1.0
2526
* Fixed a bug in `Get-AzVM` that caused incorrect power status output.
2627

src/Compute/Compute/VirtualMachine/Config/SetAzureVMBootDiagnosticsCommand.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public class SetAzureVMBootDiagnosticsCommand : Microsoft.Azure.Commands.Resourc
5656
public SwitchParameter Disable { get; set; }
5757

5858
[Parameter(
59-
Mandatory = true,
6059
Position = 2,
6160
ParameterSetName = EnableParameterSet,
6261
ValueFromPipelineByPropertyName = true,
@@ -86,14 +85,7 @@ public override void ExecuteCmdlet()
8685

8786
if (this.Enable.IsPresent)
8887
{
89-
if (string.IsNullOrEmpty(this.StorageAccountName))
90-
{
91-
if (diagnosticsProfile.BootDiagnostics.StorageUri == null)
92-
{
93-
ThrowNoStorageAccount();
94-
}
95-
}
96-
else
88+
if (!string.IsNullOrEmpty(this.StorageAccountName))
9789
{
9890
var storageClient = AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(
9991
DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);

src/Compute/Compute/help/Set-AzVMBootDiagnostic.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Modifies boot diagnostics properties of a virtual machine.
1515

1616
### EnableBootDiagnostics
1717
```
18-
Set-AzVMBootDiagnostic [-VM] <PSVirtualMachine> [-Enable] [-ResourceGroupName] <String>
18+
Set-AzVMBootDiagnostic [-VM] <PSVirtualMachine> [-Enable] [[-ResourceGroupName] <String>]
1919
[[-StorageAccountName] <String>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2020
```
2121

@@ -34,7 +34,7 @@ The **Set-AzVMBootDiagnostic** cmdlet modifies boot diagnostics properties of a
3434
```
3535
PS C:\> $VM = Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "ContosoVM07"
3636
PS C:\> Set-AzVMBootDiagnostic -VM $VM -Enable -ResourceGroupName "ResourceGroup11" -StorageAccountName "DiagnosticStorage"
37-
PS C:\> Update-AzVM -VM $VM
37+
PS C:\> Update-AzVM -VM $VM -ResourceGroupName "ResourceGroup11"
3838
```
3939

4040
The first command gets the virtual machine named ContosoVM07 by using **Get-AzVM**.
@@ -97,15 +97,15 @@ Type: System.String
9797
Parameter Sets: EnableBootDiagnostics
9898
Aliases:
9999

100-
Required: True
100+
Required: False
101101
Position: 2
102102
Default value: None
103103
Accept pipeline input: True (ByPropertyName)
104104
Accept wildcard characters: False
105105
```
106106
107107
### -StorageAccountName
108-
Specifies the name of the storage account in which to save boot diagnostics data.
108+
Specifies the name of the storage account in which to save boot diagnostics data. If not provided, it will look for a StorageUri in the BootDiagnostic Profile in the PSVirtualMachine object provided in the '-VM' parameter. If StorageUri is null, it will default to used a managed storage account.
109109
110110
```yaml
111111
Type: System.String

src/Sql/Sql.Test/ScenarioTests/ServerCrudTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ public void TestServerUpdateWithIdentity()
6868
RunPowerShellTest("Test-UpdateServerWithIdentity");
6969
}
7070

71+
[Fact]
72+
[Trait(Category.AcceptanceType, Category.CheckIn)]
73+
public void TestServerCreateWithFederatedClientId()
74+
{
75+
RunPowerShellTest("Test-CreateServerWithFederatedClientId");
76+
}
77+
78+
[Fact]
79+
[Trait(Category.AcceptanceType, Category.CheckIn)]
80+
public void TestServerUpdateWithFederatedClientId()
81+
{
82+
RunPowerShellTest("Test-UpdatingServerWithFederatedClientId");
83+
}
84+
7185
[Fact]
7286
[Trait(Category.AcceptanceType, Category.CheckIn)]
7387
public void TestServerUpdateWithoutIdentity()

src/Sql/Sql.Test/ScenarioTests/ServerCrudTests.ps1

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,69 @@ function Test-UpdateServerWithoutIdentity
255255
}
256256
}
257257

258+
<#
259+
.SYNOPSIS
260+
Tests creating a server with a federated client id
261+
#>
262+
function Test-CreateServerWithFederatedClientId
263+
{
264+
# Setup
265+
$rg = Create-ResourceGroupForTest
266+
267+
$serverName = Get-ServerName
268+
$serverLogin = "testusername"
269+
$serverPassword = "t357ingP@s5w0rd!"
270+
$credentials = new-object System.Management.Automation.PSCredential($serverLogin, ($serverPassword | ConvertTo-SecureString -asPlainText -Force))
271+
$federatedClientId = "3728d52a-7b46-47a9-8a8c-318c27263eef";
272+
273+
try
274+
{
275+
New-AzSqlServer -ResourceGroupName $rg.ResourceGroupName -ServerName $serverName -Location "eastus2euap" -SqlAdministratorCredentials $credentials -FederatedClientId $federatedClientId -AssignIdentity
276+
$respserver = Get-AzSqlServer -ResourceGroupName $rg.ResourceGroupName -ServerName $serverName
277+
Assert-AreEqual $respserver.ServerName $serverName
278+
Assert-AreEqual $respserver.FederatedClientId $federatedClientId
279+
}
280+
finally
281+
{
282+
Remove-ResourceGroupForTest $rg
283+
}
284+
}
285+
286+
<#
287+
.SYNOPSIS
288+
Tests updating a server with a federated client id
289+
#>
290+
function Test-UpdatingServerWithFederatedClientId
291+
{
292+
# Setup
293+
$rg = Create-ResourceGroupForTest
294+
295+
$serverName = Get-ServerName
296+
$serverLogin = "testusername"
297+
$serverPassword = "t357ingP@s5w0rd!"
298+
$credentials = new-object System.Management.Automation.PSCredential($serverLogin, ($serverPassword | ConvertTo-SecureString -asPlainText -Force))
299+
$federatedClientId = "3728d52a-7b46-47a9-8a8c-318c27263eef";
300+
$updatedFederatedClientId = "dac7a46b-3dc9-4893-ab34-18169a917073";
301+
302+
try
303+
{
304+
$server1 = New-AzSqlServer -ResourceGroupName $rg.ResourceGroupName -ServerName $serverName -Location "eastus2euap" -SqlAdministratorCredentials $credentials -FederatedClientId $federatedClientId -AssignIdentity
305+
Assert-AreEqual $server1.ServerName $serverName
306+
Assert-AreEqual $server1.FederatedClientId $federatedClientId
307+
308+
# Update server with new Federated client id
309+
$newPassword = "n3wc00lP@55w0rd"
310+
$secureString = ConvertTo-SecureString $newPassword -AsPlainText -Force
311+
$server2 = Set-AzSqlServer -ResourceGroupName $rg.ResourceGroupName -ServerName $server1.ServerName -SqlAdministratorPassword $secureString -FederatedClientId $updatedFederatedClientId
312+
Assert-AreEqual $server2.FederatedClientId $updatedFederatedClientId
313+
}
314+
finally
315+
{
316+
Remove-ResourceGroupForTest $rg
317+
}
318+
}
319+
320+
258321
<#
259322
.SYNOPSIS
260323
Tests create and update a server with minimal TLS version

0 commit comments

Comments
 (0)