Skip to content

Commit ed13af4

Browse files
author
Hovsep
committed
Merge pull request #2111 from dsouzaarun/dev
Fixing bug in Set-AzureSBAuthorizationRule cmdlet
2 parents 4d1111d + 46de9bb commit ed13af4

16 files changed

+35
-26
lines changed

src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
103103
<Private>True</Private>
104104
</Reference>
105-
<Reference Include="Microsoft.ServiceBus, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
106-
<HintPath>..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
105+
<Reference Include="Microsoft.ServiceBus">
106+
<HintPath>..\..\..\packages\WindowsAzure.ServiceBus.2.8.2\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
107107
</Reference>
108108
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
109109
<SpecificVersion>False</SpecificVersion>
@@ -384,7 +384,6 @@
384384
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
385385
</Content>
386386
<None Include="packages.config" />
387-
<None Include="Performance\Microsoft.ServiceBus.MessagingPerformanceCounters.man" />
388387
<None Include="Profile\SelectAzureSubscriptionTests.ps1">
389388
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
390389
</None>

src/ServiceManagement/Services/Commands.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />
3131
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
3232
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
33-
<package id="WindowsAzure.ServiceBus" version="2.3.2.0" targetFramework="net45" />
33+
<package id="WindowsAzure.ServiceBus" version="2.8.2" targetFramework="net45" />
3434
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
3535
<package id="xunit" version="2.1.0" targetFramework="net45" />
3636
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />

src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
104104
<Private>True</Private>
105105
</Reference>
106-
<Reference Include="Microsoft.ServiceBus, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
107-
<HintPath>..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
106+
<Reference Include="Microsoft.ServiceBus, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
107+
<HintPath>..\..\..\packages\WindowsAzure.ServiceBus.2.8.2\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
108108
</Reference>
109109
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
110110
<SpecificVersion>False</SpecificVersion>

src/ServiceManagement/Services/Commands.Utilities/ServiceBus/ServiceBusClientExtensions.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,16 @@ public ServiceBusClientExtensions()
290290
/// Creates new instance from ServiceBusClientExtensions
291291
/// </summary>
292292
/// <param name="subscription"></param>
293-
public ServiceBusClientExtensions(AzureSMProfile profile, AzureSubscription subscription)
293+
public ServiceBusClientExtensions(AzureSMProfile profile)
294294
{
295-
subscriptionId = subscription.Id.ToString();
296-
Subscription = subscription;
297-
ServiceBusClient = AzureSession.ClientFactory.CreateClient<ServiceBusManagementClient>(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement);
295+
if (profile.Context.Subscription == null)
296+
{
297+
throw new ArgumentException(Resources.InvalidDefaultSubscription);
298+
}
299+
300+
subscriptionId = profile.Context.Subscription.Id.ToString();
301+
Subscription = profile.Context.Subscription;
302+
ServiceBusClient = AzureSession.ClientFactory.CreateClient<ServiceBusManagementClient>(profile, profile.Context.Subscription, AzureEnvironment.Endpoint.ServiceManagement);
298303
}
299304

300305
/// <summary>
@@ -838,7 +843,7 @@ public virtual bool NamespaceExists(string name)
838843
return GetNamespace().Exists(ns => ns.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
839844
}
840845

841-
public virtual ExtendedServiceBusNamespace CreateNamespace(string name, string location, NamespaceType type, bool createACSNamespace = true)
846+
public virtual ExtendedServiceBusNamespace CreateNamespace(string name, string location, NamespaceType type, bool createACSNamespace = false)
842847
{
843848
location = string.IsNullOrEmpty(location) ? GetDefaultLocation() : location;
844849

@@ -936,7 +941,9 @@ static public SharedAccessAuthorizationRule ToSharedAccessAuthorizationRule(
936941
rights.Add(AccessRights.Send);
937942
}
938943

939-
return new SharedAccessAuthorizationRule(sbRule.KeyName, sbRule.PrimaryKey, sbRule.SecondaryKey, rights);
944+
var sasRule = new SharedAccessAuthorizationRule(sbRule.KeyName, sbRule.PrimaryKey, sbRule.SecondaryKey, rights);
945+
sasRule.Revision = sbRule.Revision;
946+
return sasRule;
940947
}
941948

942949
static public ServiceBusConnectionDetail ToServiceBusConnectionDetail(this ServiceBusNamespaceDescription namespaceDesc)

src/ServiceManagement/Services/Commands.Utilities/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
<package id="Microsoft.WindowsAzure.Management.WebSites" version="5.0.0-prerelease" targetFramework="net45" />
3131
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
3232
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
33-
<package id="WindowsAzure.ServiceBus" version="2.3.2.0" targetFramework="net45" />
33+
<package id="WindowsAzure.ServiceBus" version="2.8.2" targetFramework="net45" />
3434
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
3535
</packages>

src/ServiceManagement/Services/Commands/CloudService/TestAzureName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public override void ExecuteCmdlet()
112112
}
113113
else
114114
{
115-
ServiceBusClient = ServiceBusClient ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
115+
ServiceBusClient = ServiceBusClient ?? new ServiceBusClientExtensions(Profile);
116116
IsServiceBusNamespaceAvailable(Profile.Context.Subscription.Id.ToString(), Name);
117117
}
118118
}

src/ServiceManagement/Services/Commands/Commands.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
9696
<Private>True</Private>
9797
</Reference>
98-
<Reference Include="Microsoft.ServiceBus, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
99-
<HintPath>..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
98+
<Reference Include="Microsoft.ServiceBus, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
99+
<HintPath>..\..\..\packages\WindowsAzure.ServiceBus.2.8.2\lib\net40-full\Microsoft.ServiceBus.dll</HintPath>
100100
</Reference>
101101
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
102102
<SpecificVersion>False</SpecificVersion>
@@ -114,6 +114,9 @@
114114
<SpecificVersion>False</SpecificVersion>
115115
<HintPath>..\..\..\lib\Microsoft.Web.Deployment.dll</HintPath>
116116
</Reference>
117+
<Reference Include="Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
118+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.0.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
119+
</Reference>
117120
<Reference Include="Microsoft.WindowsAzure.Management">
118121
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
119122
</Reference>
@@ -338,7 +341,6 @@
338341
<None Include="packages.config">
339342
<SubType>Designer</SubType>
340343
</None>
341-
<None Include="Performance\Microsoft.ServiceBus.MessagingPerformanceCounters.man" />
342344
</ItemGroup>
343345
<ItemGroup>
344346
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj">

src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBAuthorizationRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class GetAzureSBAuthorizationRuleCommand : AzureSMCmdlet
6262

6363
public override void ExecuteCmdlet()
6464
{
65-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
65+
Client = Client ?? new ServiceBusClientExtensions(Profile);
6666
List<ExtendedAuthorizationRule> rules = null;
6767
List<PSObject> output = new List<PSObject>();
6868
AuthorizationRuleFilterOption options = new AuthorizationRuleFilterOption()

src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBLocation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class GetAzureSBLocationCommand : AzureSMCmdlet
3333
/// </summary>
3434
public override void ExecuteCmdlet()
3535
{
36-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
36+
Client = Client ?? new ServiceBusClientExtensions(Profile);
3737
WriteObject(Client.GetServiceBusRegions(), true);
3838
}
3939
}

src/ServiceManagement/Services/Commands/ServiceBus/GetAzureSBNamespace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class GetAzureSBNamespaceCommand : AzureSMCmdlet
3535
/// </summary>
3636
public override void ExecuteCmdlet()
3737
{
38-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
38+
Client = Client ?? new ServiceBusClientExtensions(Profile);
3939

4040
if (string.IsNullOrEmpty(Name))
4141
{

src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBAuthorizationRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class NewAzureSBAuthorizationRuleCommand : AzureSMCmdlet
6262

6363
public override void ExecuteCmdlet()
6464
{
65-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
65+
Client = Client ?? new ServiceBusClientExtensions(Profile);
6666
ExtendedAuthorizationRule rule = null;
6767
PSObject output = null;
6868

src/ServiceManagement/Services/Commands/ServiceBus/NewAzureSBNamespace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class NewAzureSBNamespaceCommand : AzureSMCmdlet
4545
/// </summary>
4646
public override void ExecuteCmdlet()
4747
{
48-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
48+
Client = Client ?? new ServiceBusClientExtensions(Profile);
4949
if (CreateACSNamespace.HasValue)
5050
{
5151
WriteObject(Client.CreateNamespace(Name, Location, NamespaceType, CreateACSNamespace.Value));

src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBAuthorizationRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class RemoveAzureSBAuthorizationRuleCommand : AzureSMCmdlet
5656

5757
public override void ExecuteCmdlet()
5858
{
59-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
59+
Client = Client ?? new ServiceBusClientExtensions(Profile);
6060
AuthorizationRuleFilterOption options = new AuthorizationRuleFilterOption()
6161
{
6262
Namespace = Namespace,

src/ServiceManagement/Services/Commands/ServiceBus/RemoveAzureSBNamespace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public override void ExecuteCmdlet()
4848
Name,
4949
() =>
5050
{
51-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
51+
Client = Client ?? new ServiceBusClientExtensions(Profile);
5252
Client.RemoveNamespace(Name);
5353

5454
if (PassThru)

src/ServiceManagement/Services/Commands/ServiceBus/SetAzureSBAuthorizationRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class SetAzureSBAuthorizationRuleCommand : AzureSMCmdlet
6666

6767
public override void ExecuteCmdlet()
6868
{
69-
Client = Client ?? new ServiceBusClientExtensions(Profile, Profile.Context.Subscription);
69+
Client = Client ?? new ServiceBusClientExtensions(Profile);
7070
ExtendedAuthorizationRule rule = null;
7171
PSObject output = null;
7272

src/ServiceManagement/Services/Commands/packages.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
1515
<package id="Microsoft.Rest.ClientRuntime" version="2.1.0" targetFramework="net45" />
1616
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.0.1-preview" targetFramework="net45" />
17+
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.0.0" targetFramework="net45" />
1718
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1819
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.6.0" targetFramework="net45" />
1920
<package id="Microsoft.WindowsAzure.Management.MediaServices" version="4.0.0" targetFramework="net45" />
@@ -26,5 +27,5 @@
2627
<package id="Microsoft.WindowsAzure.Management.WebSites" version="5.0.0-prerelease" targetFramework="net45" />
2728
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
2829
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
29-
<package id="WindowsAzure.ServiceBus" version="2.3.2.0" targetFramework="net45" />
30+
<package id="WindowsAzure.ServiceBus" version="2.8.2" targetFramework="net45" />
3031
</packages>

0 commit comments

Comments
 (0)