From b79c14a663796243ed3c982850b28f7843bd8418 Mon Sep 17 00:00:00 2001 From: dolauli Date: Thu, 10 Jun 2021 13:25:38 +0800 Subject: [PATCH] change the branch name from master to main --- .azure-pipelines/daily-build.yml | 2 +- .../Debugging-StaticAnalysis-Errors.md | 4 +- .../azure-powershell-developer-guide.md | 4 +- .../development-docs/cleaning-up-commits.md | 6 +- .../cmdlet-best-practices.md | 2 +- .../examples/private-link-resource-example.md | 6 +- .../generate-format.ps1xml-file.md | 14 ++-- .../development-docs/help-generation.md | 2 +- .../development-docs/sdkbased-vs-autogen.md | 6 +- .../development-docs/vm-for-partners.md | 6 +- .../resource-manager-active-directory.md | 72 +++++++++---------- .../using-azure-test-framework.md | 2 +- documentation/troubleshoot-ci.md | 2 +- 13 files changed, 64 insertions(+), 64 deletions(-) diff --git a/.azure-pipelines/daily-build.yml b/.azure-pipelines/daily-build.yml index a03c816ba021..8487599db95f 100644 --- a/.azure-pipelines/daily-build.yml +++ b/.azure-pipelines/daily-build.yml @@ -5,7 +5,7 @@ schedules: displayName: Daily Midnight Build branches: include: - - master + - main pr: none diff --git a/documentation/Debugging-StaticAnalysis-Errors.md b/documentation/Debugging-StaticAnalysis-Errors.md index c7ab2bcca422..3f35f5dfd69c 100644 --- a/documentation/Debugging-StaticAnalysis-Errors.md +++ b/documentation/Debugging-StaticAnalysis-Errors.md @@ -42,7 +42,7 @@ _Note_: Sometimes the error listed in the .csv file can be a false positive (for We take breaking changes very seriously, so please be mindful about the violations that you suppress in our repo. ### Signature Issues -Signature issues occur when your cmdlets do not follow PowerShell standards. Please check the [_Cmdlet Best Practices_](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/design-guidelines/cmdlet-best-practices.md) and the [_Parameter Best Practices_](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/design-guidelines/parameter-best-practices.md) documents to ensure you are following PowerShell guidelines. Issues with severity 0 or 1 must be addressed, while issues with severity 2 are advisory. If you have an issue with severity 0 or 1 that has been approved by the Azure PowerShell team, you can suppress them following these steps: +Signature issues occur when your cmdlets do not follow PowerShell standards. Please check the [_Cmdlet Best Practices_](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/cmdlet-best-practices.md) and the [_Parameter Best Practices_](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/design-guidelines/parameter-best-practices.md) documents to ensure you are following PowerShell guidelines. Issues with severity 0 or 1 must be addressed, while issues with severity 2 are advisory. If you have an issue with severity 0 or 1 that has been approved by the Azure PowerShell team, you can suppress them following these steps: - Download the `SignatureIssues.csv` file from the Jenkins build - Open the file using a text editor (such as VS Code) and copy each of the errors you'd like to suppress @@ -51,4 +51,4 @@ Signature issues occur when your cmdlets do not follow PowerShell standards. Pl - Push the changes to the .csv file and ensure the errors no longer show up in the `SignatureIssues.csv` file output from the Jenkins build. ### Help Issues -Most help issues that cause StaticAnalysis to fail occur when help has not been added for a particular cmdlet. If you have not generated help for your new cmdlets, please follow the instructions [here](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/help-generation.md). If this is not the issue, follow the steps listed under "Remediation" for each violation listed in HelpIssues.csv. +Most help issues that cause StaticAnalysis to fail occur when help has not been added for a particular cmdlet. If you have not generated help for your new cmdlets, please follow the instructions [here](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/help-generation.md). If this is not the issue, follow the steps listed under "Remediation" for each violation listed in HelpIssues.csv. diff --git a/documentation/development-docs/azure-powershell-developer-guide.md b/documentation/development-docs/azure-powershell-developer-guide.md index 3bc04665f615..c77499190037 100644 --- a/documentation/development-docs/azure-powershell-developer-guide.md +++ b/documentation/development-docs/azure-powershell-developer-guide.md @@ -76,10 +76,10 @@ You now be able to create your own branches, commit changes, and push commits to git remote add upstream https://github.com/Azure/azure-powershell.git ``` -Then, to pull changes from the **master** branch in _Azure/azure-powershell_ into your local working branch, run the following command: +Then, to pull changes from the **main** branch in _Azure/azure-powershell_ into your local working branch, run the following command: ``` -git pull upstream master +git pull upstream main ``` ## Building the Environment diff --git a/documentation/development-docs/cleaning-up-commits.md b/documentation/development-docs/cleaning-up-commits.md index 794ef2d37cde..ccc3c3d53726 100644 --- a/documentation/development-docs/cleaning-up-commits.md +++ b/documentation/development-docs/cleaning-up-commits.md @@ -60,10 +60,10 @@ For more information on squashing, click [here](https://git-scm.com/book/en/v2/G If you want to merge specific commits from another branch into the current one you are working from, use **cherry-picking**. -For example, if you're working on the **master** branch and want to pull commit X (the commit-hash) from the **feature** branch, you may run the following commands: +For example, if you're working on the **main** branch and want to pull commit X (the commit-hash) from the **feature** branch, you may run the following commands: ``` -git checkout master +git checkout main git cherry-pick X -n ``` @@ -73,7 +73,7 @@ Now, if you want to cherry-pick a range of commits, say X through Y, from the ** ``` git checkout -b temp-branch X -git rebase --onto master Y^ +git rebase --onto main Y^ ``` For more information on cherry-picking, click [here](https://git-scm.com/docs/git-cherry-pick). \ No newline at end of file diff --git a/documentation/development-docs/design-guidelines/cmdlet-best-practices.md b/documentation/development-docs/design-guidelines/cmdlet-best-practices.md index 3f36e87bdcdf..c976be7154bb 100644 --- a/documentation/development-docs/design-guidelines/cmdlet-best-practices.md +++ b/documentation/development-docs/design-guidelines/cmdlet-best-practices.md @@ -139,7 +139,7 @@ $job | Wait-Job $subscriptions = $job | Receive-Job ```` -To set a custom job name, please use [`SetBackgroupJobDescription`](https://github.com/Azure/azure-powershell-common/blob/master/src/Common/AzurePSCmdlet.cs#L810). The default job description is: "Long Running Operation for '{cmdlet name}' on resource '{resource name}'" +To set a custom job name, please use [`SetBackgroupJobDescription`](https://github.com/Azure/azure-powershell-common/blob/main/src/Common/AzurePSCmdlet.cs#L810). The default job description is: "Long Running Operation for '{cmdlet name}' on resource '{resource name}'" ### Required Parameter Sets diff --git a/documentation/development-docs/examples/private-link-resource-example.md b/documentation/development-docs/examples/private-link-resource-example.md index 1e76e77bc2f9..37d9560f0640 100644 --- a/documentation/development-docs/examples/private-link-resource-example.md +++ b/documentation/development-docs/examples/private-link-resource-example.md @@ -23,18 +23,18 @@ if "List Private Endpoint Connection API" is not available, `Private Endpoint Co `privateEndpointConnections` need to be defined under this API ## Code Changes Needed -Add corresponding {Provider}, {Top-Level-Resource} and {API-Version} into [ProviderConfiguration.cs](https://github.com/Azure/azure-powershell/blob/master/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs#L12) +Add corresponding {Provider}, {Top-Level-Resource} and {API-Version} into [ProviderConfiguration.cs](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs#L12) in following pattern: ``` RegisterConfiguration("{Provider}/{Top-Level-Resource}", "{API-Version}") ``` For example: -if "List Private Endpoint Connection API" is [available](https://github.com/Azure/azure-powershell/blob/master/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs#L74), +if "List Private Endpoint Connection API" is [available](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs#L74), ``` RegisterConfiguration("Microsoft.Sql/servers", "2018-06-01-preview") ``` -if "List Private Endpoint Connection API" is [not available](https://github.com/Azure/azure-powershell/blob/master/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs#L93), provide extra bool parameter 'false' +if "List Private Endpoint Connection API" is [not available](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs#L93), provide extra bool parameter 'false' ``` RegisterConfiguration("Microsoft.Storage/storageAccounts", "2019-06-01", false) ``` diff --git a/documentation/development-docs/generate-format.ps1xml-file.md b/documentation/development-docs/generate-format.ps1xml-file.md index 5be222b8ff67..39599935ec1d 100644 --- a/documentation/development-docs/generate-format.ps1xml-file.md +++ b/documentation/development-docs/generate-format.ps1xml-file.md @@ -14,7 +14,7 @@ Our team trends to make the cmdlets output more convenient and consistent across # How table view output works by default. - As an example let's consider [Get-AzSubscription](https://github.com/Azure/azure-powershell/blob/master/src/Accounts/Accounts/Subscription/GetAzureRMSubscription.cs) cmdlet. + As an example let's consider [Get-AzSubscription](https://github.com/Azure/azure-powershell/blob/main/src/Accounts/Accounts/Subscription/GetAzureRMSubscription.cs) cmdlet. The cmdlet class specifies the ```PSAzureSubscription``` class as an output type with the **OutputType attribute**: @@ -31,7 +31,7 @@ namespace Microsoft.Azure.Commands.Profile // omitted for brevity the rest of the definition. ``` -The [PSAzureSubscription](https://github.com/Azure/azure-powershell-common/blob/master/src/Authentication.ResourceManager/Models/PSAzureSubscription.cs) class contains several public properties. +The [PSAzureSubscription](https://github.com/Azure/azure-powershell-common/blob/main/src/Authentication.ResourceManager/Models/PSAzureSubscription.cs) class contains several public properties. * Id * Name @@ -122,7 +122,7 @@ To provide a better PowerShell Azure cmdlets output experience we worked out a m # Ps1XmlAttribute attribute. -The key element of the mechanism is the **Ps1XmlAttribute** attribute located in the [Commands.Common](https://github.com/Azure/azure-powershell-common/blob/master/src/Common/Attributes/Ps1XmlAttribute.cs) project. Below is the attribute definition: +The key element of the mechanism is the **Ps1XmlAttribute** attribute located in the [Commands.Common](https://github.com/Azure/azure-powershell-common/blob/main/src/Common/Attributes/Ps1XmlAttribute.cs) project. Below is the attribute definition: ```Cs namespace Microsoft.WindowsAzure.Commands.Common.Attributes @@ -223,7 +223,7 @@ namespace Microsoft.Azure.Commands.Profile.Models ``` * If **Label** is not specified - the property name will be used. -* Since the **Ps1Xml attribute** definition is located in the [Commands.Common](https://github.com/Azure/azure-powershell-common/tree/master/src/Common) project and the Command.Common project is likely referenced from your project - to make the attribute visible - you only need to add ```using Microsoft.WindowsAzure.Commands.Common.Attributes;``` statement. +* Since the **Ps1Xml attribute** definition is located in the [Commands.Common](https://github.com/Azure/azure-powershell-common/tree/main/src/Common) project and the Command.Common project is likely referenced from your project - to make the attribute visible - you only need to add ```using Microsoft.WindowsAzure.Commands.Common.Attributes;``` statement. ## Properties of complex types. @@ -425,12 +425,12 @@ c9cbd920-c00c-427c-852b-c329e824c3a8 Azure SDK Powershell Test Enabled 72f988bf- **Note:** All the paths used in the example in the section are under **_azure-powershell/src/Accounts_** -1. Copy the generated file into your project source folder. In our example this is [src/Accounts/Accounts](https://github.com/Azure/azure-powershell/tree/master/src/Accounts/Accounts) folder. +1. Copy the generated file into your project source folder. In our example this is [src/Accounts/Accounts](https://github.com/Azure/azure-powershell/tree/main/src/Accounts/Accounts) folder. -2. Reference the generated format.ps1xml file form your project. In our example this is [Accounts.csproj](https://github.com/Azure/azure-powershell/blob/master/src/Accounts/Accounts/Accounts.csproj) file. +2. Reference the generated format.ps1xml file form your project. In our example this is [Accounts.csproj](https://github.com/Azure/azure-powershell/blob/main/src/Accounts/Accounts/Accounts.csproj) file. - **Note**: This is now automatically referenced based on `Az.props` being imported in your csproj file. -3. Add the generated format.ps1xml file to your source module manifest **FormatsToProcess** variable. In our example this is [src/Accounts/Az.Accounts.psd1](https://github.com/Azure/azure-powershell/blob/master/src/Accounts/Az.Accounts.psd1) file: +3. Add the generated format.ps1xml file to your source module manifest **FormatsToProcess** variable. In our example this is [src/Accounts/Az.Accounts.psd1](https://github.com/Azure/azure-powershell/blob/main/src/Accounts/Az.Accounts.psd1) file: ```Powershell # script omitted for brevity diff --git a/documentation/development-docs/help-generation.md b/documentation/development-docs/help-generation.md index 362cde639871..cd1e10226997 100644 --- a/documentation/development-docs/help-generation.md +++ b/documentation/development-docs/help-generation.md @@ -79,7 +79,7 @@ If you would like to update the inputs/outputs for a markdown file, please run t This will update all of the markdown files with public interface changes made to corresponding cmdlets, add markdown files for any new cmdlets, remove markdown files for any deleted cmdlets, and update the module page (_e.g.,_ `Az.Accounts.md`) with any added or removed cmdlets. -_This seems to work better when run from within the `help` folder itself (For e.g. to generate the help files for the [`Network`](https://github.com/Azure/azure-powershell/tree/master/src/Network) module run the cmd from under [`Commands.Network/help`](https://github.com/Azure/azure-powershell/tree/master/src/Network/Network/help)). Also, you will have to import the profile module from under /artifacts/Debug/Az.Accounts/Az.Accounts.psd1_ +_This seems to work better when run from within the `help` folder itself (For e.g. to generate the help files for the [`Network`](https://github.com/Azure/azure-powershell/tree/main/src/Network) module run the cmd from under [`Commands.Network/help`](https://github.com/Azure/azure-powershell/tree/main/src/Network/Network/help)). Also, you will have to import the profile module from under /artifacts/Debug/Az.Accounts/Az.Accounts.psd1_ #### Updating a single markdown file diff --git a/documentation/development-docs/sdkbased-vs-autogen.md b/documentation/development-docs/sdkbased-vs-autogen.md index 2e5fa98873aa..0cc1ecafa7e6 100644 --- a/documentation/development-docs/sdkbased-vs-autogen.md +++ b/documentation/development-docs/sdkbased-vs-autogen.md @@ -31,7 +31,7 @@ Highlight parameters differences in auto-gen modules as below. - Implement cmdlets in C# based on management SDK for Dotnet - Implement testcases - Generate docs, and populate them with examples -- Create a PR in master branch for code review +- Create a PR in main branch for code review ### Auto-gen Module @@ -45,7 +45,7 @@ Highlight parameters differences in auto-gen modules as below. - Implement testcases - Generate docs and populate them with examples - Create a PR in **generation** branch for code review -- Azure team members will help merge code from generation branch to master branch +- Azure team members will help merge code from generation branch to main branch ## Customization @@ -78,7 +78,7 @@ Generally speaking, hero scenarios are implemented through customization through ### SDK-based Module -Docs are generated through playPS, please see [platyPS](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/help-generation.md#Installing-platyPS) for details. And developers should populate generated docs with examples. +Docs are generated through playPS, please see [platyPS](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/help-generation.md#Installing-platyPS) for details. And developers should populate generated docs with examples. ### Auto-gen Module diff --git a/documentation/development-docs/vm-for-partners.md b/documentation/development-docs/vm-for-partners.md index 9cc1e7655067..98fd4b55cade 100644 --- a/documentation/development-docs/vm-for-partners.md +++ b/documentation/development-docs/vm-for-partners.md @@ -1,4 +1,4 @@ -If you need an Azure Virtual Machine with all the [prerequisites](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/azure-powershell-developer-guide.md#prerequisites) installed and ready to build and test Powershell Azure - follow the steps below. +If you need an Azure Virtual Machine with all the [prerequisites](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/azure-powershell-developer-guide.md#prerequisites) installed and ready to build and test Powershell Azure - follow the steps below. # Copy the PowerShell Azure VHD blob to your subscription and create a VM from it. @@ -134,7 +134,7 @@ git config --global user.email "" ``` git config --global user.name "" ``` -Next, you will need to follow the steps [here](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/azure-powershell-developer-guide.md#environment-setup) to set up your local fork of Azure/azure-powershell. +Next, you will need to follow the steps [here](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/azure-powershell-developer-guide.md#environment-setup) to set up your local fork of Azure/azure-powershell. # Building and Running Tests -This image has been set up to build and run tests immediately. To build the project, run msbuild build.proj in the Developer Command Prompt for VS2015. Once this has completed, you can open your module in Visual Studio and start development there. To record tests, follow the instructions [here](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/azure-powershell-developer-guide.md#recordingrunning-tests). +This image has been set up to build and run tests immediately. To build the project, run msbuild build.proj in the Developer Command Prompt for VS2015. Once this has completed, you can open your module in Visual Studio and start development there. To record tests, follow the instructions [here](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/azure-powershell-developer-guide.md#recordingrunning-tests). diff --git a/documentation/internal/resource-manager-active-directory.md b/documentation/internal/resource-manager-active-directory.md index cdaf07fb2a00..471420d36927 100644 --- a/documentation/internal/resource-manager-active-directory.md +++ b/documentation/internal/resource-manager-active-directory.md @@ -53,11 +53,11 @@ Because a resource's ID contains the identifier properties of the resource (reso The cmdlets currently found in the `Az.Resources` module that act upon resources are the following: -- [`Get-AzResource`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzResource.md) -- [`Move-AzResource`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Move-AzResource.md) -- [`New-AzResource`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzResource.md) -- [`Remove-AzResource`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzResource.md) -- [`Set-AzResource`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Set-AzResource.md) +- [`Get-AzResource`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzResource.md) +- [`Move-AzResource`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Move-AzResource.md) +- [`New-AzResource`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzResource.md) +- [`Remove-AzResource`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzResource.md) +- [`Set-AzResource`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Set-AzResource.md) #### `Get-AzResource` @@ -81,31 +81,31 @@ Get-AzResource -ResourceGroupName test-rg -Name test* Get-AzResource -ResourceGroupName test* -Name test ``` -The cmdlet uses the [`TopLevelWildcardFilter()`](https://github.com/Azure/azure-powershell-common/blob/master/src/ResourceManager/Version2016_09_01/AzureRMCmdlet.cs#L394-L435) call in our common code to [filter the results by the given wildcard](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L185). +The cmdlet uses the [`TopLevelWildcardFilter()`](https://github.com/Azure/azure-powershell-common/blob/main/src/ResourceManager/Version2016_09_01/AzureRMCmdlet.cs#L394-L435) call in our common code to [filter the results by the given wildcard](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L185). **Uses both `HttpClient` and `ResourceManagerClient`** As mentioned previously, the `ResourceManager` project has a mix of cmdlets that use a generic `HttpClient` and/or the `ResourceManagerClient` to make calls to the server. Where applicable, calls that could be made using the `ResourceManagerClient` were implemented and replaced the calls using the generic `HttpClient`. -First, the cmdlet tries to [construct a resource ID](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L129-L132) out of the parameters provided, specifically, `-ResourceGroupName`, `-ResourceType` and `-Name`. If the user provided a value for all three of these parameters (and didn't include wildcards in either `-ResourceGroupName` or `-Name`), then we would make a [call to get the resource by ID](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L136) using the `ResourceManagerClient`. Since the `GetById()` call on the client requires both the resource ID _and_ the API version of the service, we make an additional [call to the client to get the resource provider](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs#L1143-L1164) of the resource we're trying to get, and when we [match the resource type from the provider](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs#L1168-L1170), we use either the default API version previously provided, or the latest API version of the service, and then [make the `GetById()` call](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs#L1173-L1177). +First, the cmdlet tries to [construct a resource ID](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L129-L132) out of the parameters provided, specifically, `-ResourceGroupName`, `-ResourceType` and `-Name`. If the user provided a value for all three of these parameters (and didn't include wildcards in either `-ResourceGroupName` or `-Name`), then we would make a [call to get the resource by ID](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L136) using the `ResourceManagerClient`. Since the `GetById()` call on the client requires both the resource ID _and_ the API version of the service, we make an additional [call to the client to get the resource provider](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs#L1143-L1164) of the resource we're trying to get, and when we [match the resource type from the provider](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs#L1168-L1170), we use either the default API version previously provided, or the latest API version of the service, and then [make the `GetById()` call](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/SdkClient/ResourceManagerSdkClient.cs#L1173-L1177). If the resource ID could not be constructed, but the user did provide a value for `-ResourceId`, then it would also follow the same flow mentioned above _unless_ the ID provided was partial and not pointing to a specific resource, but a collection of resources. For example, the resource ID `/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM` points to a specific VM called "MyVM" in the resource group "MyResourceGroup", but if the user were to provide the ID `/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines`, then we would expect to return _all_ VMs in the resource group "MyResourceGroup". Since the `ResourceManagerClient` does not support this scenario, we need to use the generic `HttpClient` to list these resources for the given resource ID. The last scenario that we would possibly use the generic `HttpClient` for this cmdlet would be if the user provided either the `-ApiVersion` or `-ExpandProperties` parameters. The `-ApiVersion` parameter is used to define which API version of the service should be used when retrieving the resource(s), which can change the values in the `Properties` property on the returned object(s). By default the `Get-AzResource` cmdlet is handled by the ARM service and returns only the generic parts of the resource managed by ARM which are common to all resources (e.g., `ResourceId`, `Sku`, `Tags`, etc.). The `-ExpandProperties` switch parameter is used to signal that the `Properties` property on the returned object(s) should be expanded and include all resource specific information. The `ResourceManagerClient` doesn't allow for either of these scenarios (outside of providing an API version for a resource ID, which was covered previously), so the `HttpClient` must be used to provide users with this functionality. -For all other scenarios, the `ResourceManagerClient` is used either to [list all resources in a given resource group](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L178) or [list all resources in the current subscription](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L182). +For all other scenarios, the `ResourceManagerClient` is used either to [list all resources in a given resource group](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L178) or [list all resources in the current subscription](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/GetAzureResourceCmdlet.cs#L182). **New-AzResource** -Unlike the `Get-AzResource` cmdlet, the `New-AzResource` cmdlet only uses the generic `HttpClient` to make calls to the server to create a resource. With this cmdlet, a user can create a resource at the tenant or subscription level against a specified API version with a defined set of properties. The cmdlet [constructs the resource ID](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/NewAzureResourceCmdlet.cs#L96) from the given identity parameters, [sets up the body](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/NewAzureResourceCmdlet.cs#L105) of the request from the property parameters, and [sends the `PUT` request](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/NewAzureResourceCmdlet.cs#L107-L124) to the server using the `HttpClient` in order to create the resource. +Unlike the `Get-AzResource` cmdlet, the `New-AzResource` cmdlet only uses the generic `HttpClient` to make calls to the server to create a resource. With this cmdlet, a user can create a resource at the tenant or subscription level against a specified API version with a defined set of properties. The cmdlet [constructs the resource ID](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/NewAzureResourceCmdlet.cs#L96) from the given identity parameters, [sets up the body](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/NewAzureResourceCmdlet.cs#L105) of the request from the property parameters, and [sends the `PUT` request](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/NewAzureResourceCmdlet.cs#L107-L124) to the server using the `HttpClient` in order to create the resource. In the future, it should be determined whether or not the `ResourceManagerClient` can be used to make the subscription level calls as it has two functions, `CreateOrUpdate()` and `CreateOrUpdateById()`, which should be able to perform the same steps outlined above. **Set-AzResource** -Also like the `New-AzResource` cmdlet, the `Set-AzResource` cmdlet only uses the generic `HttpClient` to make calls to the server to update a resource. This cmdlet gives users the ability to perform either a `PUT` or `PATCH` operation on the server to update the given resource. If the user provides the identity properties of a resource as parameters, they can perform a `PATCH` operation by providing the `-UsePatchSemantics` switch, providing a value for the `-Tag` or `-Sku` parameters, or not providing a value for the `-Plan`, `-Properties` and `-Kind` parameters. If the user doesn't do [any of the previous three](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/SetAzureResourceCmdlet.cs#L226-L229), than the cmdlet will perform a `PUT` operation. +Also like the `New-AzResource` cmdlet, the `Set-AzResource` cmdlet only uses the generic `HttpClient` to make calls to the server to update a resource. This cmdlet gives users the ability to perform either a `PUT` or `PATCH` operation on the server to update the given resource. If the user provides the identity properties of a resource as parameters, they can perform a `PATCH` operation by providing the `-UsePatchSemantics` switch, providing a value for the `-Tag` or `-Sku` parameters, or not providing a value for the `-Plan`, `-Properties` and `-Kind` parameters. If the user doesn't do [any of the previous three](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/SetAzureResourceCmdlet.cs#L226-L229), than the cmdlet will perform a `PUT` operation. -If the user provides a `PSResource` object to the `-InputObject` parameter, then the cmdlet will push the value of the properties on the object to the server, [unless overwritten by a parameter provided on the command line](https://github.com/Azure/azure-powershell/blob/master/src/Resources/ResourceManager/Implementation/Resource/SetAzureResourceCmdlet.cs#L94-L102). For example, if the user provides a `PSResource` for `-InputObject` and a new `Hashtable` for `-Tag`, then the tags defined on the given resource will be overwritten with whatever is in the `Hashtable` provided, and all other properties on the `PSResource` will be pushed to the server. +If the user provides a `PSResource` object to the `-InputObject` parameter, then the cmdlet will push the value of the properties on the object to the server, [unless overwritten by a parameter provided on the command line](https://github.com/Azure/azure-powershell/blob/main/src/Resources/ResourceManager/Implementation/Resource/SetAzureResourceCmdlet.cs#L94-L102). For example, if the user provides a `PSResource` for `-InputObject` and a new `Hashtable` for `-Tag`, then the tags defined on the given resource will be overwritten with whatever is in the `Hashtable` provided, and all other properties on the `PSResource` will be pushed to the server. #### Piping Scenarios @@ -133,13 +133,13 @@ _The application object serves as the template from which common and default pro The cmdlets currently found in the `Az.Resources` module that act upon applications are the following: -- [`Get-AzADAppCredential`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADAppCredential.md) -- [`Get-AzADApplication`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADApplication.md) -- [`New-AzADAppCredential`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzADAppCredential.md) -- [`New-AzADApplication`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzADApplication.md) -- [`Remove-AzADAppCredential`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADAppCredential.md) -- [`Remove-AzADApplication`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADApplication.md) -- [`Update-AzADApplication`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Update-AzADApplication.md) +- [`Get-AzADAppCredential`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADAppCredential.md) +- [`Get-AzADApplication`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADApplication.md) +- [`New-AzADAppCredential`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzADAppCredential.md) +- [`New-AzADApplication`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzADApplication.md) +- [`Remove-AzADAppCredential`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADAppCredential.md) +- [`Remove-AzADApplication`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADApplication.md) +- [`Update-AzADApplication`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Update-AzADApplication.md) #### Piping Scenarios @@ -168,12 +168,12 @@ _Using groups lets the resource owner (or Azure AD directory owner), assign a se The cmdlets currently found in the `Az.Resources` module that act upon groups are the following: -- [`Add-AzADGroupMember`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Add-AzADGroupMember.md) -- [`Get-AzADGroup`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADGroup.md) -- [`Get-AzADGroupMember`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADGroupMember.md) -- [`New-AzADGroup`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzADGroup.md) -- [`Remove-AzADGroup`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADGroup.md) -- [`Remove-AzADGroupMember`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADGroupMember.md) +- [`Add-AzADGroupMember`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Add-AzADGroupMember.md) +- [`Get-AzADGroup`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADGroup.md) +- [`Get-AzADGroupMember`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADGroupMember.md) +- [`New-AzADGroup`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzADGroup.md) +- [`Remove-AzADGroup`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADGroup.md) +- [`Remove-AzADGroupMember`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADGroupMember.md) #### Piping Scenarios @@ -201,17 +201,17 @@ _A service principal must be created in each tenant where the application is use The cmdlets currently found in the `Az.Resources` module that act upon service principals are the following: -- [`Get-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADServicePrincipal.md) -- [`Get-AzADSpCredential`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADSpCredential.md) -- [`New-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzADServicePrincipal.md) -- [`New-AzADSpCredential`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzADSpCredential.md) -- [`Remove-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADServicePrincipal.md) -- [`Remove-AzADSpCredential`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADSpCredential.md) -- [`Update-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Update-AzADServicePrincipal.md) +- [`Get-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADServicePrincipal.md) +- [`Get-AzADSpCredential`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADSpCredential.md) +- [`New-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzADServicePrincipal.md) +- [`New-AzADSpCredential`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzADSpCredential.md) +- [`Remove-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADServicePrincipal.md) +- [`Remove-AzADSpCredential`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADSpCredential.md) +- [`Update-AzADServicePrincipal`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Update-AzADServicePrincipal.md) #### User Scenarios -A common scenario is for a user to create a service principal in order to automate Azure management tasks.When a service principal is used to automate management tasks, it must have a credential, and it must be given permissions to manage the resources that are part of its task. The `New-AzADServicePrincipal` cmdlet allows the user to create a service principal, give it secure credentials, and allow the service principal the appropriate level of access in Azure through issuing a single cmdlet. If the user provided a value for either the `-Role` or `-Scope` parameter, once the service principal was created, a [call to the authorization SDK](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/ActiveDirectory/Cmdlets/NewAzureADServicePrincipalCommand.cs#L346-L380) would be made to assign the specified role to the service principal over the given scope. If neither parameter was provided, or the `-SkipAssignment` switch was set, then a role assignment would not be created. If only `-Role` was provided, `-Scope` would be [set to the user's current subscription](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/ActiveDirectory/Cmdlets/NewAzureADServicePrincipalCommand.cs#L252-L256), and if only `-Scope` was provided, `-Role` would be [set to the "Contributor"](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/ActiveDirectory/Cmdlets/NewAzureADServicePrincipalCommand.cs#L260-L264). +A common scenario is for a user to create a service principal in order to automate Azure management tasks.When a service principal is used to automate management tasks, it must have a credential, and it must be given permissions to manage the resources that are part of its task. The `New-AzADServicePrincipal` cmdlet allows the user to create a service principal, give it secure credentials, and allow the service principal the appropriate level of access in Azure through issuing a single cmdlet. If the user provided a value for either the `-Role` or `-Scope` parameter, once the service principal was created, a [call to the authorization SDK](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/ActiveDirectory/Cmdlets/NewAzureADServicePrincipalCommand.cs#L346-L380) would be made to assign the specified role to the service principal over the given scope. If neither parameter was provided, or the `-SkipAssignment` switch was set, then a role assignment would not be created. If only `-Role` was provided, `-Scope` would be [set to the user's current subscription](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/ActiveDirectory/Cmdlets/NewAzureADServicePrincipalCommand.cs#L252-L256), and if only `-Scope` was provided, `-Role` would be [set to the "Contributor"](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/ActiveDirectory/Cmdlets/NewAzureADServicePrincipalCommand.cs#L260-L264). ```powershell # Create a service principal with no permissions @@ -276,10 +276,10 @@ Get-AzADServicePrincipal @FilterParameters | Remove-AzADSpCredential The cmdlets currently found in this `Az.Resources` module that act upon users are the following: -- [`Get-AzADUser`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Get-AzADUser.md) -- [`New-AzADUser`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/New-AzADUser.md) -- [`Remove-AzADUser`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Remove-AzADUser.md) -- [`Update-AzADUser`](https://github.com/Azure/azure-powershell/blob/master/src/Resources/Resources/help/Update-AzADUser.md) +- [`Get-AzADUser`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Get-AzADUser.md) +- [`New-AzADUser`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/New-AzADUser.md) +- [`Remove-AzADUser`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Remove-AzADUser.md) +- [`Update-AzADUser`](https://github.com/Azure/azure-powershell/blob/main/src/Resources/Resources/help/Update-AzADUser.md) #### Piping Scenarios diff --git a/documentation/testing-docs/using-azure-test-framework.md b/documentation/testing-docs/using-azure-test-framework.md index 9add957a6a8a..9e614927bb1d 100644 --- a/documentation/testing-docs/using-azure-test-framework.md +++ b/documentation/testing-docs/using-azure-test-framework.md @@ -124,7 +124,7 @@ AZURE_TEST_MODE=Record ## Record or Playback Tests -- [Run the tests](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/azure-powershell-developer-guide.md#recordingrunning-tests) and make sure that you got a generated `.json` file that matches the test name in the bin folder under the `SessionRecords` folder +- [Run the tests](https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/azure-powershell-developer-guide.md#recordingrunning-tests) and make sure that you got a generated `.json` file that matches the test name in the bin folder under the `SessionRecords` folder - Copy the `SessionRecords` folder inside the test project and add all `*.json` files in Visual Studio setting "Copy to Output Directory" property to "Copy if newer" - To assure that the records work fine, delete the connection string (default mode is Playback mode) OR change HttpRecorderMode within the connection string to "Playback" and run the tests diff --git a/documentation/troubleshoot-ci.md b/documentation/troubleshoot-ci.md index fe1309f7e27f..be23e2e312d5 100644 --- a/documentation/troubleshoot-ci.md +++ b/documentation/troubleshoot-ci.md @@ -44,7 +44,7 @@ The url should exactly match the schema `https://docs.microsoft.com/en-us/powers ### Message -> c:\workspace\powershell\build.proj(597,5): error MSB3073: The command "c:\workspace\powershell\artifacts\\**StaticAnalysis.exe** -p c:\workspace\powershell\artifacts\Debug -r c:\workspace\powershell\artifacts -m Az.Network" exited with code 255.c:\workspace\powershell\build.proj(609,5): error : StaticAnalysis has failed. Please follow the instructions on this doc: [https://github.com/Azure/azure-powershell/blob/master/documentation/Debugging-StaticAnalysis-Errors.md](Debugging-StaticAnalysis-Errors.md) +> c:\workspace\powershell\build.proj(597,5): error MSB3073: The command "c:\workspace\powershell\artifacts\\**StaticAnalysis.exe** -p c:\workspace\powershell\artifacts\Debug -r c:\workspace\powershell\artifacts -m Az.Network" exited with code 255.c:\workspace\powershell\build.proj(609,5): error : StaticAnalysis has failed. Please follow the instructions on this doc: [https://github.com/Azure/azure-powershell/blob/main/documentation/Debugging-StaticAnalysis-Errors.md](Debugging-StaticAnalysis-Errors.md) ### Reasons