Skip to content

Commit 9bc5d9b

Browse files
author
Maddie Clayton
authored
Merge pull request #6478 from Azure/master
Merging master into Preview
2 parents 12da7cd + ad83e17 commit 9bc5d9b

File tree

114 files changed

+3814
-1097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3814
-1097
lines changed

ChangeLog.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,63 @@
1-
## 6.2.1 - June 2018
1+
## 6.3.0 - June 2018
2+
#### AzureRM.Profile
3+
* Updated error messages for Enable-AzureRmContextAutoSave
4+
* Create a context for each subscription when running 'Connect-AzureRmAccount' with no previous context
5+
6+
#### Azure.Storage
7+
* Added additional information about -Permissions parameter in help files.
8+
9+
#### AzureRM.Compute
10+
* 'Get-AzureRmVmDiskEncryptionStatus' fixes an issue observed for VMs with no data disks
11+
* Update Compute client library version to fix following cmdlets
12+
- Grant-AzureRmDiskAccess
13+
- Grant-AzureRmSnapshotAccess
14+
- Save-AzureRmVMImage
15+
* Fixed following cmdlets to show 'operation ID' and 'operation status' correctly:
16+
- Start-AzureRmVM
17+
- Stop-AzureRmVM
18+
- Restart-AzureRmVM
19+
- Set-AzureRmVM
20+
- Remove-AzuerRmVM
21+
- Set-AzureRmVmss
22+
- Start-AzureRmVmssRollingOSUpgrade
23+
- Stop-AzureRmVmssRollingUpgrade
24+
- Start-AzureRmVmss
25+
- Restart-AzureRmVmss
26+
- Stop-AzureRmVmss
27+
- Remove-AzureRmVmss
28+
- ConvertTo-AzureRmVMManagedDisk
29+
- Revoke-AzureRmSnapshotAccess
30+
- Remove-AzureRmSnapshot
31+
- Revoke-AzureRmDiskAccess
32+
- Remove-AzureRmDisk
33+
- Remove-AzureRmContainerService
34+
- Remove-AzureRmAvailabilitySet
35+
36+
#### AzureRM.EventGrid
37+
* Remove ValidateNotNullOrEmpty validation conditions for SubjectBeginsWith/SubjectEndsWith in Update-AzureRmEventGridSubscription cmdlet to allow changing these parameters to empty string if needed.
38+
39+
#### AzureRM.KeyVault
40+
* Fix issue where no Tags are being returned when Get-AzureRmKeyVault -Tag is run
41+
42+
#### AzureRM.PolicyInsights
43+
* Public release of Policy Insights cmdlets
44+
- Use API version 2018-04-04
45+
- Add PolicyDefinitionReferenceId to the results of Get-AzureRmPolicyStateSummary
46+
47+
#### AzureRM.RecoveryServices.Backup
48+
* Added -Vault parameter to RecoveryServices.Backup cmdlets. When passed, this will override the Set-AzureRmRecoveryServicesContext cmdlet.
49+
50+
#### AzureRM.Sql
51+
* Updated example in the help file for Get-AzureRmSqlDatabaseExpanded
52+
53+
#### AzureRM.TrafficManager
54+
* Updated the help file for Add-AzureRmTrafficManagerEndpointConfig
55+
56+
#### AzureRM.Websites
57+
* 'Set-AzureRmWebApp' is updated to not overwrite the AppSettings when using -AssignIdentity
58+
* 'New-AzureRmWebAppSlot' is updated to honor AppServicePlan as an optional parameter
59+
60+
## 6.2.1 - June 2018
261
### AzureRM.OperationalInsights
362
* Updated PSWorkspace model to allow Network to use type as a parameter
463

src/Common/Commands.Common/AzurePowerShell.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public class AzurePowerShell
2626

2727
public const string AssemblyCopyright = "Copyright © Microsoft";
2828

29-
public const string AssemblyVersion = "6.2.1";
29+
public const string AssemblyVersion = "6.3.0";
3030

31-
public const string AssemblyFileVersion = "6.2.1";
31+
public const string AssemblyFileVersion = "6.3.0";
3232

3333
public const string ProfileFile = "AzureProfile.json";
3434

src/ResourceManager/Aks/AzureRM.Aks.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\YamlDotNet.dll',

src/ResourceManager/AnalysisServices/AzureRM.AnalysisServices.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.Analysis.dll'

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Azure.AnalysisServices.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CLRVersion='4.0'
4848
ProcessorArchitecture = 'None'
4949

5050
# Modules that must be imported into the global environment prior to importing this module
51-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
51+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5252

5353
# Assemblies that must be loaded prior to importing this module
5454
RequiredAssemblies = @()

src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\AutoMapper.dll',

src/ResourceManager/ApplicationInsights/AzureRM.ApplicationInsights.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.ApplicationInsights.dll'

src/ResourceManager/Automation/AzureRM.Automation.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.Automation.dll'

src/ResourceManager/AzureBackup/AzureRM.Backup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.BackupServicesManagement.dll',

src/ResourceManager/AzureBatch/AzureRM.Batch.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Batch.dll',

src/ResourceManager/Billing/AzureRM.Billing.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.Billing.dll'

src/ResourceManager/Cdn/AzureRM.Cdn.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.Cdn.dll'

src/ResourceManager/CognitiveServices/AzureRM.CognitiveServices.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Azure.Management.CognitiveServices.dll'
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Management.Automation;
5+
using System.Threading;
6+
using Microsoft.Azure.Commands.Common.Authentication;
7+
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
8+
using Microsoft.Azure.Management.Internal.Resources;
9+
using Microsoft.Azure.Management.Internal.Resources.Models;
10+
using Microsoft.Rest.Azure.OData;
11+
12+
namespace Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters
13+
{
14+
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
15+
public class ResourceIdCompleterAttribute : ArgumentCompleterAttribute
16+
{
17+
private static readonly object Lock = new object();
18+
19+
/// <summary>
20+
/// Consturctor
21+
/// </summary>
22+
/// <param name="resourceType">Azure recource type</param>
23+
public ResourceIdCompleterAttribute(string resourceType)
24+
: base(CreateScriptBlock(resourceType))
25+
{}
26+
27+
public static ScriptBlock CreateScriptBlock(string resourceType)
28+
{
29+
string script = "param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)\n" +
30+
$"$resourceType = \"{resourceType}\"\n" +
31+
"$resourceIds = [Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters.ResourceIdCompleterAttribute]::GetResourceIds($resourceType)\n" +
32+
"$resourceIds | Where-Object { $_ -Like \"*$wordToComplete*\" } | Sort-Object | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }";
33+
var scriptBlock = ScriptBlock.Create(script);
34+
return scriptBlock;
35+
}
36+
37+
private class CacheItem
38+
{
39+
public DateTime Timestamp { get; set; }
40+
public IEnumerable<string> ResourceInfoList { get; set; }
41+
}
42+
43+
private static readonly IDictionary<int, CacheItem> Cache = new Dictionary<int, CacheItem>();
44+
45+
public static TimeSpan TimeToUpdate { get; set; } = TimeSpan.FromMinutes(5);
46+
47+
public static TimeSpan RequestTimeout { get; set; } = TimeSpan.FromSeconds(3);
48+
49+
public static IEnumerable<string> GetResourceIds(string resourceType)
50+
{
51+
lock (Lock)
52+
{
53+
var context = AzureRmProfileProvider.Instance.Profile.DefaultContext;
54+
var contextHash = HashContext(context, resourceType);
55+
var cacheItem = Cache.ContainsKey(contextHash) ? Cache[contextHash] : null;
56+
57+
if (cacheItem != null && DateTime.Now.Subtract(cacheItem.Timestamp).CompareTo(TimeToUpdate) < 0)
58+
{
59+
return Cache[contextHash].ResourceInfoList;
60+
}
61+
62+
var client = AzureSession.Instance.ClientFactory.CreateArmClient<ResourceManagementClient>(context, AzureEnvironment.Endpoint.ResourceManager);
63+
64+
var odata = new ODataQuery<GenericResourceFilter>(r => r.ResourceType == resourceType);
65+
66+
IEnumerable<string> resourceInfoList = new List<string>();
67+
68+
try
69+
{
70+
using (var cancelSource = new CancellationTokenSource())
71+
{
72+
var task = client.Resources.ListAsync(odata, cancelSource.Token);
73+
74+
if (!task.Wait(RequestTimeout))
75+
{
76+
cancelSource.Cancel();
77+
return resourceInfoList;
78+
}
79+
80+
var result = task.Result;
81+
resourceInfoList = result
82+
.Select(r => r.Id)
83+
.ToList();
84+
}
85+
}
86+
catch (Exception)
87+
{
88+
return resourceInfoList;
89+
}
90+
91+
if (cacheItem != null)
92+
{
93+
cacheItem.Timestamp = DateTime.Now;
94+
cacheItem.ResourceInfoList = resourceInfoList;
95+
Cache[contextHash] = cacheItem;
96+
}
97+
else
98+
{
99+
Cache.Add(contextHash, new CacheItem
100+
{
101+
Timestamp = DateTime.Now,
102+
ResourceInfoList = resourceInfoList
103+
});
104+
}
105+
106+
return resourceInfoList;
107+
}
108+
}
109+
110+
private static int HashContext(IAzureContext context, string resourceType)
111+
{
112+
return (context.Account.Id + context.Environment.Name + context.Subscription.Id + context.Tenant.Id + resourceType).GetHashCode();
113+
}
114+
}
115+
}

src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
<ItemGroup>
5757
<Compile Include="AccessTokenExtensions.cs" />
5858
<Compile Include="ArgumentCompleters\PSArgumentCompleter.cs" />
59+
<Compile Include="ArgumentCompleters\ResourceIdCompleter.cs" />
5960
<Compile Include="ArgumentCompleters\ResourceTypeCompleter.cs" />
6061
<Compile Include="ArgumentCompleters\ScopeCompleter.cs" />
6162
<Compile Include="AzureRmCmdlet.cs" />

src/ResourceManager/Compute.ManagedService/AzureRM.Compute.ManagedService.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\Microsoft.Data.Edm.dll', '.\Microsoft.Data.OData.dll',

src/ResourceManager/Compute/AzureRM.Compute.psd1

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 5/29/2018
6+
# Generated on: 6/12/2018
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '5.1.0'
15+
ModuleVersion = '5.1.1'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.2.0'; })
54+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.3.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = '.\AutoMapper.dll', '.\Microsoft.Azure.Management.Compute.dll',
@@ -215,9 +215,31 @@ PrivateData = @{
215215
# IconUri = ''
216216

217217
# ReleaseNotes of this module
218-
ReleaseNotes = '* VMSS VM Update feature
219-
- Added ''Update-AzureRmVmssVM'' and ''New-AzureRmVMDataDisk'' cmdlets
220-
- Add VirtualMachineScaleSetVM parameter to ''Add-AzureRmVMDataDisk'' cmdlet to support adding a data disk to Vmss VM.'
218+
ReleaseNotes = '* ''Get-AzureRmVmDiskEncryptionStatus'' fixes an issue observed for VMs with no data disks
219+
* Update Compute client library version to fix following cmdlets
220+
- Grant-AzureRmDiskAccess
221+
- Grant-AzureRmSnapshotAccess
222+
- Save-AzureRmVMImage
223+
* Fixed following cmdlets to show ''operation ID'' and ''operation status'' correctly:
224+
- Start-AzureRmVM
225+
- Stop-AzureRmVM
226+
- Restart-AzureRmVM
227+
- Set-AzureRmVM
228+
- Remove-AzuerRmVM
229+
- Set-AzureRmVmss
230+
- Start-AzureRmVmssRollingOSUpgrade
231+
- Stop-AzureRmVmssRollingUpgrade
232+
- Start-AzureRmVmss
233+
- Restart-AzureRmVmss
234+
- Stop-AzureRmVmss
235+
- Remove-AzureRmVmss
236+
- ConvertTo-AzureRmVMManagedDisk
237+
- Revoke-AzureRmSnapshotAccess
238+
- Remove-AzureRmSnapshot
239+
- Revoke-AzureRmDiskAccess
240+
- Remove-AzureRmDisk
241+
- Remove-AzureRmContainerService
242+
- Remove-AzureRmAvailabilitySet'
221243

222244
# Prerelease string of this module
223245
# Prerelease = ''

0 commit comments

Comments
 (0)