Skip to content

Commit af7c7a0

Browse files
authored
Merge pull request #2 from markcowl/disablevpn
Update to latest and fix on-demand issue
2 parents cd8521f + dfde18a commit af7c7a0

File tree

30 files changed

+172169
-379
lines changed

30 files changed

+172169
-379
lines changed

src/Common/Commands.Common.Graph.RBAC/ActiveDirectory/ActiveDirectoryBaseCmdlet.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,19 @@ private void HandleException(Exception exception)
5353

5454
if (graphEx != null)
5555
{
56-
if (graphEx.Body != null)
57-
{
56+
if (graphEx.Body != null && graphEx.Body.Message != null && graphEx.Body.Code != null) {
5857
WriteDebug(String.Format(ProjectResources.GraphException, graphEx.Body.Code, graphEx.Body.Message));
5958
targetEx = new Exception(graphEx.Body.Message);
6059
targetErrorId = graphEx.Body.Code;
60+
} else {
61+
if (graphEx.Response != null && graphEx.Response.StatusCode == HttpStatusCode.NotFound) {
62+
targetErrorCategory = ErrorCategory.InvalidArgument;
63+
} else {
64+
targetErrorCategory = ErrorCategory.InvalidOperation;
65+
}
66+
Exception parsedException = ParseResponse(graphEx);
67+
targetEx = parsedException != null? parsedException : targetEx;
6168
}
62-
63-
if (graphEx.Response != null && graphEx.Response.StatusCode == HttpStatusCode.NotFound)
64-
{
65-
targetErrorCategory = ErrorCategory.InvalidArgument;
66-
}
67-
else
68-
{
69-
targetErrorCategory = ErrorCategory.InvalidOperation;
70-
}
71-
7269
var errorRecord = new ErrorRecord(targetEx, targetErrorId, targetErrorCategory, null);
7370
WriteError(errorRecord);
7471
}
@@ -77,6 +74,19 @@ private void HandleException(Exception exception)
7774
throw exception;
7875
}
7976
}
77+
78+
79+
private Exception ParseResponse(GraphErrorException graphEx) {
80+
int exceptionMessageIndex = graphEx.Response.Content.IndexOf("\"value\":", StringComparison.CurrentCultureIgnoreCase);
81+
if (exceptionMessageIndex > 0)
82+
{
83+
string substring = graphEx.Response.Content.Substring(exceptionMessageIndex+9);
84+
// the start index is added 9, so as to remove the delimiter \"value\":\
85+
string exceptionDetails = substring.Substring(0,substring.IndexOf("\"}"));
86+
return new Exception(exceptionDetails);
87+
}
88+
return null;
89+
}
8090

8191
protected void ExecutionBlock(Action execAction)
8292
{

src/ResourceManager/AnalysisServices/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Added a new dataplane commandlet to allow synchronization of databases from read-write instance to read-only instances
22+
- Included help file for the commandlet
23+
- Added in-memory tests and a scenario test (only live)
24+
* Fixed bugs in Add-AzureAsAccount commandlet
2125

2226
## Version 0.4.4
2327

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/AnalysisServicesDataplaneStartup.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# ----------------------------------------------------------------------------------
1414

1515
@{
16-
"Login-AzureAsAccount" = "Restart-AzureAnalysisServicesInstance";
17-
"Restart-AzureAsInstance" = "Set-AzureRmContext";
16+
"Login-AzureAsAccount" = "Add-AzureAnalysisServicesAccount";
17+
"Restart-AzureAsInstance" = "Restart-AzureAnalysisServicesInstance";
18+
"Sync-AzureAsInstance" = "Sync-AzureAnalysisServicesInstance";
1819
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ FunctionsToExport = '*'
6767
# Cmdlets to export from this module
6868
CmdletsToExport = 'Add-AzureAnalysisServicesAccount',
6969
'Restart-AzureAnalysisServicesInstance',
70-
'Export-AzureAnalysisServicesInstanceLog'
70+
'Export-AzureAnalysisServicesInstanceLog',
71+
'Sync-AzureAnalysisServicesInstance'
7172

7273
# Variables to export from this module
7374
VariablesToExport = '*'

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Commands.AnalysisServices.Dataplane.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<ItemGroup>
9090
<Compile Include="Commands\AddAzureASAccount.cs" />
9191
<Compile Include="Commands\Export-AzureAsInstanceLog.cs" />
92+
<Compile Include="Commands\Synchronize-AzureASInstance.cs" />
9293
<Compile Include="Models\AsAzureAccount.cs" />
9394
<Compile Include="Models\AsAzureClientSession.cs" />
9495
<Compile Include="Models\ASAzureContext.cs" />
@@ -97,6 +98,11 @@
9798
<Compile Include="Models\AsAzureProfile.cs" />
9899
<Compile Include="Commands\Restart-AzureAsInstance.cs" />
99100
<Compile Include="Models\AsAzureAuthenticationProvider.cs" />
101+
<Compile Include="Models\DatabaseSyncState.cs" />
102+
<Compile Include="Models\ScaleOutServerDatabaseSyncDetail.cs" />
103+
<Compile Include="Models\ClusterResolutionResult.cs" />
104+
<Compile Include="Models\ScaleOutServerDatabaseSyncResult.cs" />
105+
<Compile Include="Models\SynchronizationFailedException.cs" />
100106
<Compile Include="Models\TokenCacheItemProvider.cs" />
101107
<Compile Include="Properties\AssemblyInfo.cs" />
102108
<Compile Include="Properties\Resources.Designer.cs">

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Dataplane/Commands/AddAzureASAccount.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ protected override string DataCollectionWarning
9696

9797
protected override void BeginProcessing()
9898
{
99-
base.BeginProcessing();
99+
this._dataCollectionProfile = new AzurePSDataCollectionProfile(false);
100+
100101
if (string.IsNullOrEmpty(RolloutEnvironment))
101102
{
102103
RolloutEnvironment = AsAzureClientSession.GetDefaultEnvironmentName();
@@ -110,6 +111,7 @@ protected override void BeginProcessing()
110111
{
111112
AsEnvironment = AsAzureClientSession.Instance.Profile.CreateEnvironment(RolloutEnvironment);
112113
}
114+
base.BeginProcessing();
113115
}
114116

115117
protected override void InitializeQosEvent()

0 commit comments

Comments
 (0)