-
Notifications
You must be signed in to change notification settings - Fork 4k
add cmdlet open-azsurveylink #15205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
VeryEarly
merged 16 commits into
Azure:release-2021-06-15
from
VeryEarly:add-opensurvey
Jun 10, 2021
Merged
add cmdlet open-azsurveylink #15205
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3dab787
add cmdlet open-azsurveylink
VeryEarly bcbdea8
move new cmdlet under feedback folder
VeryEarly 27ef3f7
remove white space
VeryEarly 0b9a5a4
add help markdown for new cmdlet
VeryEarly f9713cf
update common version
VeryEarly 1b4f366
suppress signature issue
VeryEarly 8ffcc8f
Merge branch 'release-2021-06-15' into add-opensurvey
VeryEarly b2459b5
update parent class
VeryEarly 6fb2677
update namespace for share assembly
VeryEarly 452ef15
upgrade common version
VeryEarly 2a90a50
add example
VeryEarly 84abe3d
Merge branch 'release-2021-06-15' into add-opensurvey
VeryEarly 5165fdd
Merge branch 'add-opensurvey' of https://github.com/VeryEarly/azure-p…
VeryEarly 59787ce
fix help markdown
VeryEarly 7e46008
add required assembly
VeryEarly ad15f1c
Merge branch 'release-2021-06-15' into add-opensurvey
VeryEarly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.Common.Authentication.Abstractions; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
using System; | ||
using System.Diagnostics; | ||
using System.Management.Automation; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Microsoft.Azure.Commands.Profile.Survey | ||
{ | ||
[Cmdlet(VerbsCommon.Open, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "SurveyLink"), OutputType(typeof(void))] | ||
public class OpenAzSurveyLinkCmdlet : AzurePSCmdlet | ||
{ | ||
private const string _surveyLinkFormat = "https://aka.ms/azpssurvey?Q_CHL=INTERCEPT"; | ||
|
||
protected override IAzureContext DefaultContext => null; | ||
|
||
protected override string DataCollectionWarning => null; | ||
|
||
public override void ExecuteCmdlet() | ||
{ | ||
WriteInformation(new HostInformationMessage() { Message = $"Opening the default browser to {_surveyLinkFormat}" }, new string[] { "PSHOST" }); | ||
OpenBrowser(_surveyLinkFormat); | ||
} | ||
|
||
private void OpenBrowser(string url) | ||
{ | ||
try | ||
{ | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
url = url.Replace("&", "^&"); | ||
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true }); | ||
} | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
Process.Start("xdg-open", url); | ||
} | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
Process.Start("open", url); | ||
} | ||
else | ||
{ | ||
throw new PlatformNotSupportedException(RuntimeInformation.OSDescription); | ||
} | ||
} | ||
catch | ||
{ | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
external help file: Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml | ||
Module Name: Az.Accounts | ||
online version: https://docs.microsoft.com/powershell/module/az.accounts/open-azsurveylink | ||
schema: 2.0.0 | ||
--- | ||
|
||
# Open-AzSurveyLink | ||
|
||
## SYNOPSIS | ||
Open survey link in default browser. | ||
|
||
## SYNTAX | ||
|
||
``` | ||
Open-AzSurveyLink [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
Open survey link in default browser. | ||
|
||
## EXAMPLES | ||
|
||
### Example 1 | ||
``` | ||
Open-AzSurveyLink | ||
Opening the default browser to https://aka.ms/azpssurvey?Q_CHL=INTERCEPT | ||
``` | ||
|
||
## PARAMETERS | ||
|
||
### -DefaultProfile | ||
The credentials, account, tenant, and subscription used for communication with Azure. | ||
|
||
```yaml | ||
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer | ||
Parameter Sets: (All) | ||
Aliases: AzContext, AzureRmContext, AzureCredential | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### CommonParameters | ||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
||
## INPUTS | ||
|
||
### None | ||
|
||
## OUTPUTS | ||
|
||
## NOTES | ||
|
||
## RELATED LINKS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tools/StaticAnalysis/Exceptions/Az.Accounts/SignatureIssues.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation" | ||
"Az.Accounts","Microsoft.Azure.Commands.Profile.Survey.OpenAzSurveyLinkCmdlet","Open-AzSurveyLink","1","8100","Open-AzSurveyLink Does not support ShouldProcess but the cmdlet verb Open indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.