From 35df4df4fd4ded893daa2cdbf01a9d35daf879da Mon Sep 17 00:00:00 2001 From: Isaiah Williams Date: Fri, 10 Aug 2018 21:14:24 +0000 Subject: [PATCH] Initial Commit Initial commit to the master branch Related work items: #1, #10, #103, #104, #11, #110, #112, #116, #117, #12, #122, #125, #126, #128, #13, #130, #131, #132, #139, #143, #144, #145, #146, #149, #15, #151, #163, #164, #165, #169, #17, #170, #171, #172, #173, #175, #18, #180, #185, #186, #187, #188, #189, #19, #196, #197, #2, #20, #201, #202, #203, #209, #21, #210, #217, #225, #229, #231, #233, #237, #25, #250, #255, #257, #258, #260, #261, #265, #266, #267, #268, #269, #27, #273, #28, #294, #295, #3, #30, #303, #304, #305, #31, #310, #313, #315, #316, #317, #320, #322, #323, #324, #325, #326, #329, #331, #334, #337, #338, #339, #340, #345, #347, #348, #349, #350, #351, #38, #39, #40, #41, #42, #44, #46, #47, #48, #5, #54, #57, #6, #62, #64, #70, #71, #73, #75, #76, #77, #8, #81, #84, #85, #86, #89, #90, #91, #92, #96, #97, #98, #99 --- .editorconfig | 77 ++ .github/ISSUE_TEMPLATE/BUG_REPORT.md | 29 + .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 19 + .github/PULL_REQUEST_TEMPLATE.md | 7 + LICENSE | 21 + Partner-Center-PowerShell.sln | 47 ++ README.md | 100 ++- docs/developer-guide.md | 22 + docs/documentation-guide.md | 43 + docs/help-generation.md | 115 +++ docs/help/Add-PartnerCustomerCartLineItem.md | 124 +++ .../help/Add-PartnerCustomerUserRoleMember.md | 92 ++ docs/help/Connect-PartnerCenter.md | 103 +++ docs/help/Get-PartnerAgreementDetail.md | 46 + docs/help/Get-PartnerAuditRecord.md | 76 ++ docs/help/Get-PartnerAzureRateCard.md | 100 +++ docs/help/Get-PartnerBillingProfile.md | 46 + docs/help/Get-PartnerCountryValidation.md | 62 ++ docs/help/Get-PartnerCustomer.md | 68 ++ docs/help/Get-PartnerCustomerAgreement.md | 61 ++ docs/help/Get-PartnerCustomerCart.md | 76 ++ .../Get-PartnerCustomerConfigurationPolicy.md | 76 ++ docs/help/Get-PartnerCustomerDevice.md | 77 ++ docs/help/Get-PartnerCustomerDeviceBatch.md | 62 ++ docs/help/Get-PartnerCustomerEntitlement.md | 78 ++ docs/help/Get-PartnerCustomerLicense.md | 98 +++ ...et-PartnerCustomerLicenseDeploymentInfo.md | 61 ++ .../help/Get-PartnerCustomerManagedService.md | 83 ++ docs/help/Get-PartnerCustomerOrder.md | 110 +++ docs/help/Get-PartnerCustomerSubscription.md | 104 +++ ...rCustomerSubscriptionProvisioningStatus.md | 78 ++ ...rCustomerSubscriptionRegistrationStatus.md | 77 ++ ...Get-PartnerCustomerSubscriptionUpgrades.md | 76 ++ ...-PartnerCustomerSubscriptionUtilization.md | 143 ++++ .../Get-PartnerCustomerTrialConversion.md | 76 ++ docs/help/Get-PartnerCustomerUser.md | 131 +++ docs/help/Get-PartnerCustomerUserRole.md | 83 ++ docs/help/Get-PartnerIndirectReseller.md | 46 + docs/help/Get-PartnerInvoice.md | 69 ++ docs/help/Get-PartnerInvoiceStatement.md | 90 ++ docs/help/Get-PartnerInvoiceSummary.md | 46 + docs/help/Get-PartnerLegalProfile.md | 46 + docs/help/Get-PartnerLicenseDeploymentInfo.md | 46 + docs/help/Get-PartnerLicenseUsageInfo.md | 46 + docs/help/Get-PartnerOffer.md | 137 +++ docs/help/Get-PartnerOfferAddon.md | 76 ++ docs/help/Get-PartnerOrganizationProfile.md | 46 + docs/help/Get-PartnerProduct.md | 114 +++ docs/help/Get-PartnerProductAvailability.md | 130 +++ docs/help/Get-PartnerProductInventory.md | 108 +++ docs/help/Get-PartnerProductSKU.md | 118 +++ docs/help/Get-PartnerResellerRequestLink.md | 46 + docs/help/Get-PartnerServiceIncident.md | 77 ++ docs/help/Get-PartnerServiceRequest.md | 128 +++ docs/help/Get-PartnerServiceRequestTopic.md | 68 ++ docs/help/Get-PartnerSupportProfile.md | 46 + docs/help/New-PartnerCustomer.md | 307 +++++++ docs/help/New-PartnerCustomerAgreement.md | 154 ++++ docs/help/New-PartnerCustomerCart.md | 110 +++ docs/help/New-PartnerCustomerCartLineItem.md | 200 +++++ .../New-PartnerCustomerConfigurationPolicy.md | 214 +++++ docs/help/New-PartnerCustomerOrder.md | 111 +++ docs/help/New-PartnerCustomerOrderLineItem.md | 200 +++++ ...PartnerCustomerSubscriptionRegistration.md | 108 +++ docs/help/New-PartnerCustomerUser.md | 200 +++++ docs/help/PartnerCenter.md | 213 +++++ ...move-PartnerCustomerConfigurationPolicy.md | 83 ++ docs/help/Remove-PartnerCustomerUser.md | 136 +++ .../Remove-PartnerCustomerUserRoleMember.md | 92 ++ docs/help/Remove-PartnerSandboxCustomer.md | 93 +++ docs/help/Restore-PartnerCustomerUser.md | 136 +++ docs/help/Set-PartnerBillingProfile.md | 262 ++++++ docs/help/Set-PartnerCustomer.md | 247 ++++++ .../Set-PartnerCustomerConfigurationPolicy.md | 226 +++++ docs/help/Set-PartnerCustomerSubscription.md | 193 +++++ docs/help/Set-PartnerCustomerUser.md | 233 ++++++ docs/help/Set-PartnerLegalProfile.md | 244 ++++++ docs/help/Set-PartnerOrganizationProfile.md | 275 ++++++ docs/help/Set-PartnerSupportProfile.md | 123 +++ docs/help/Submit-PartnerCustomerCart.md | 107 +++ docs/help/Test-PartnerAddress.md | 183 ++++ docs/help/Test-PartnerDomainAvailability.md | 63 ++ docs/scenarios.md | 24 + docs/scenarios/confirm-customer-consent.md | 39 + docs/scenarios/purchase-azure-reservations.md | 84 ++ .../Authentication/EnvironmentConstants.cs | 35 + .../Authentication/EnvironmentName.cs | 34 + .../Authentication/PartnerContext.cs | 52 ++ .../Authentication/PartnerEnvironment.cs | 87 ++ .../Authentication/PartnerProfile.cs | 31 + .../Authentication/PartnerSession.cs | 37 + .../AddPartnerCustomerCartLineItem.cs | 80 ++ .../AddPartnerCustomerUserRoleMember.cs | 105 +++ .../Commands/ConnectPartnerCenter.cs | 98 +++ .../Commands/GetPartnerAgreementDetail.cs | 40 + .../Commands/GetPartnerAuditRecord.cs | 90 ++ .../Commands/GetPartnerAzureRateCard.cs | 63 ++ .../Commands/GetPartnerBillingProfile.cs | 38 + .../Commands/GetPartnerCountryValidation.cs | 37 + src/PowerShell/Commands/GetPartnerCustomer.cs | 110 +++ .../Commands/GetPartnerCustomerAgreement.cs | 48 ++ .../Commands/GetPartnerCustomerCart.cs | 50 ++ .../GetPartnerCustomerConfigurationPolicy.cs | 107 +++ .../Commands/GetPartnerCustomerDevice.cs | 59 ++ .../Commands/GetPartnerCustomerDeviceBatch.cs | 47 ++ .../Commands/GetPartnerCustomerEntitlement.cs | 102 +++ .../Commands/GetPartnerCustomerLicense.cs | 122 +++ ...GetPartnerCustomerLicenseDeploymentInfo.cs | 45 + .../GetPartnerCustomerManagedService.cs | 112 +++ .../Commands/GetPartnerCustomerOrder.cs | 127 +++ .../GetPartnerCustomerSubscription.cs | 106 +++ ...rCustomerSubscriptionProvisioningStatus.cs | 53 ++ ...rCustomerSubscriptionRegistrationStatus.cs | 53 ++ .../GetPartnerCustomerSubscriptionUpgrades.cs | 54 ++ ...tPartnerCustomerSubscriptionUtilization.cs | 110 +++ .../GetPartnerCustomerTrialConversion.cs | 51 ++ .../Commands/GetPartnerCustomerUser.cs | 221 +++++ .../Commands/GetPartnerCustomerUserRole.cs | 104 +++ .../Commands/GetPartnerIndirectReseller.cs | 40 + src/PowerShell/Commands/GetPartnerInvoice.cs | 93 +++ .../Commands/GetPartnerInvoiceStatement.cs | 95 +++ .../Commands/GetPartnerInvoiceSummary.cs | 37 + .../Commands/GetPartnerLegalProfile.cs | 38 + .../GetPartnerLicenseDeploymentInfo.cs | 45 + .../Commands/GetPartnerLicenseUsageInfo.cs | 45 + src/PowerShell/Commands/GetPartnerOffer.cs | 166 ++++ .../Commands/GetPartnerOfferAddon.cs | 54 ++ .../Commands/GetPartnerOrganizationProfile.cs | 38 + src/PowerShell/Commands/GetPartnerProduct.cs | 183 ++++ .../Commands/GetPartnerProductAvailability.cs | 152 ++++ .../Commands/GetPartnerProductInventory.cs | 114 +++ .../Commands/GetPartnerProductSKU.cs | 156 ++++ .../Commands/GetPartnerResellerRequestLink.cs | 38 + .../Commands/GetPartnerServiceIncident.cs | 70 ++ .../Commands/GetPartnerServiceRequest.cs | 215 +++++ .../Commands/GetPartnerServiceRequestTopic.cs | 64 ++ .../Commands/GetPartnerSupportProfile.cs | 38 + src/PowerShell/Commands/NewPartnerCustomer.cs | 212 +++++ .../Commands/NewPartnerCustomerAgreement.cs | 109 +++ .../Commands/NewPartnerCustomerCart.cs | 79 ++ .../NewPartnerCustomerCartLineItem.cs | 120 +++ .../NewPartnerCustomerConfigurationPolicy.cs | 109 +++ .../Commands/NewPartnerCustomerOrder.cs | 57 ++ .../NewPartnerCustomerOrderLineItem.cs | 120 +++ ...PartnerCustomerSubscriptionRegistration.cs | 49 ++ .../Commands/NewPartnerCustomerUser.cs | 122 +++ src/PowerShell/Commands/PartnerPSCmdlet.cs | 66 ++ ...emovePartnerCustomerConfigurationPolicy.cs | 59 ++ .../Commands/RemovePartnerCustomerUser.cs | 180 ++++ .../RemovePartnerCustomerUserRoleMember.cs | 63 ++ .../Commands/RemovePartnerSandboxCustomer.cs | 39 + .../Commands/RestorePartnerCustomerUser.cs | 185 ++++ .../Commands/SetPartnerBillingProfile.cs | 176 ++++ src/PowerShell/Commands/SetPartnerCustomer.cs | 158 ++++ .../SetPartnerCustomerConfigurationPolicy.cs | 137 +++ .../SetPartnerCustomerSubscription.cs | 121 +++ .../Commands/SetPartnerCustomerUser.cs | 193 +++++ .../Commands/SetPartnerLegalProfile.cs | 165 ++++ .../Commands/SetPartnerOrganizationProfile.cs | 170 ++++ .../Commands/SetPartnerSupportProfile.cs | 79 ++ .../Commands/SubmitPartnerCustomerCart.cs | 57 ++ src/PowerShell/Commands/TestPartnerAddress.cs | 99 +++ .../Commands/TestPartnerDomainAvailability.cs | 47 ++ src/PowerShell/Common/AssertExtensions.cs | 70 ++ src/PowerShell/Common/PSPartnerException.cs | 93 +++ src/PowerShell/Common/ResourceExtensions.cs | 126 +++ .../Common/SecureStringExtensions.cs | 39 + src/PowerShell/Converts/CustomerConverter.cs | 60 ++ .../Factories/AuthenticationFactory.cs | 127 +++ src/PowerShell/Factories/ClientFactory.cs | 53 ++ .../Factories/IAuthenticationFactory.cs | 28 + src/PowerShell/Factories/IClientFactory.cs | 24 + src/PowerShell/GlobalSuppressions.cs | 12 + ...ore.PartnerCenter.PowerShell.format.ps1xml | 476 +++++++++++ .../Models/Agreements/PSAgreement.cs | 63 ++ .../Models/Agreements/PSAgreementMetaData.cs | 53 ++ .../PSCustomerLicensesDeploymentInsights.cs | 47 ++ .../PSCustomerLicensesInsightsBase.cs | 40 + .../Analytics/PSLicensesInsightsBase.cs | 48 ++ .../PSPartnerLicensesDeploymentInsight.cs | 42 + .../PSPartnerLicensesUsageInsight.cs | 42 + .../Models/Auditing/PSAuditRecord.cs | 104 +++ src/PowerShell/Models/Carts/PSCart.cs | 73 ++ .../Models/Carts/PSCartCheckoutResult.cs | 45 + src/PowerShell/Models/Carts/PSCartLineItem.cs | 105 +++ .../PSConfigurationPolicy.cs | 73 ++ .../PSCountryValidationRules.cs | 116 +++ .../PSCustomerRelationshipRequest.cs | 38 + .../PsCustomerSubscriptionUpgrades.cs | 55 ++ .../PSCustomerTrialConversion.cs | 56 ++ .../Models/CustomerUsers/PSCustomerUser.cs | 85 ++ src/PowerShell/Models/Customers/PSCustomer.cs | 86 ++ .../Models/DevicesDeployment/PSDevice.cs | 87 ++ .../Models/DevicesDeployment/PSDeviceBatch.cs | 71 ++ .../Models/Entitlements/PSEntitlement.cs | 73 ++ .../Invoices/PSBaseAzureDataMarketLineItem.cs | 107 +++ .../Invoices/PSBaseUsageBasedLineItem.cs | 150 ++++ src/PowerShell/Models/Invoices/PSInvoice.cs | 114 +++ .../Models/Invoices/PSInvoiceLineItem.cs | 26 + .../Models/Invoices/PSInvoiceSummary.cs | 83 ++ .../Models/Invoices/PSLicenseBasedLineItem.cs | 171 ++++ .../Invoices/PSOneTimeInvoiceLineItem.cs | 146 ++++ .../Models/Invoices/PSUsageBasedLineItem.cs | 96 +++ src/PowerShell/Models/Licenses/PSLicense.cs | 71 ++ .../Models/Licenses/PSSubscribedSku.cs | 91 ++ .../ManagedServices/PSManagedService.cs | 84 ++ src/PowerShell/Models/Offers/PSOffer.cs | 140 ++++ src/PowerShell/Models/Orders/PSOrder.cs | 83 ++ .../Models/Orders/PSOrderLineItem.cs | 78 ++ .../Models/Partners/PSBillingProfile.cs | 68 ++ .../Models/Partners/PSLegalBusinessProfile.cs | 68 ++ .../Models/Partners/PSOrganizationProfile.cs | 74 ++ .../Models/Partners/PSSupportProfile.cs | 47 ++ .../Models/Products/PSInventoryItem.cs | 53 ++ src/PowerShell/Models/Products/PSProduct.cs | 66 ++ .../Models/Products/PSProductAvailability.cs | 88 ++ src/PowerShell/Models/Products/PSSku.cs | 113 +++ .../Models/RateCards/PSAzureRateCard.cs | 58 ++ .../Relationships/PSPartnerRelationship.cs | 75 ++ .../Models/Roles/PSDirectoryRole.cs | 70 ++ .../ServiceRequests/PSServiceRequest.cs | 133 +++ .../Models/ServiceRequests/PSSupportTopic.cs | 57 ++ .../Models/Subscriptions/PSSubscription.cs | 141 ++++ .../PSSubscriptionProvisioningStatus.cs | 59 ++ .../PSSubscriptionRegistrationStatus.cs | 42 + .../Utilizations/PSAzureUtilizationRecord.cs | 122 +++ src/PowerShell/PartnerCenter.psd1 | 132 +++ src/PowerShell/PowerShell.csproj | 262 ++++++ src/PowerShell/Properties/AssemblyInfo.cs | 37 + .../Properties/Resources.Designer.cs | 369 ++++++++ src/PowerShell/Properties/Resources.resx | 222 +++++ .../Validations/AddressValidator.cs | 114 +++ src/PowerShell/Validations/IValidator.cs | 13 + .../Validations/ValidationException.cs | 51 ++ src/PowerShell/app.config | 15 + src/PowerShell/packages.config | 12 + .../Commands/AnalyticTests.cs | 55 ++ .../Commands/AnalyticTests.ps1 | 21 + .../Commands/AuditRecordTests.cs | 65 ++ .../Commands/AuditRecordTests.ps1 | 17 + test/PowerShell.Tests/Commands/Common.ps1 | 65 ++ .../Commands/CustomerTests.cs | 375 +++++++++ .../Commands/CustomerTests.ps1 | 300 +++++++ test/PowerShell.Tests/Commands/DomainTests.cs | 42 + .../PowerShell.Tests/Commands/DomainTests.ps1 | 10 + .../Commands/IndirectTests.cs | 43 + .../Commands/IndirectTests.ps1 | 11 + .../PowerShell.Tests/Commands/InvoiceTests.cs | 53 ++ .../Commands/InvoiceTests.ps1 | 15 + test/PowerShell.Tests/Commands/OfferTests.cs | 127 +++ test/PowerShell.Tests/Commands/OfferTests.ps1 | 40 + .../PowerShell.Tests/Commands/PartnerTests.cs | 204 +++++ .../Commands/PartnerTests.ps1 | 67 ++ .../PowerShell.Tests/Commands/ProductTests.cs | 96 +++ .../Commands/ProductTests.ps1 | 98 +++ .../Commands/RateCardTests.cs | 57 ++ .../Commands/RateCardTests.ps1 | 27 + .../Commands/ValidationTests.cs | 50 ++ .../Commands/ValidationTests.ps1 | 10 + .../Converters/CustomerConverTests.cs | 72 ++ .../ResourceCollectionEnumerator.cs | 108 +++ .../Factories/MockAuthenticationFactory.cs | 42 + .../Factories/MockClientFactory.cs | 41 + .../Factories/OperationFactory.cs | 180 ++++ test/PowerShell.Tests/PowerShell.Tests.csproj | 289 +++++++ test/PowerShell.Tests/PowerShellExtensions.cs | 24 + .../Properties/AssemblyInfo.cs | 19 + .../AddCustomerUserRoleMember.json | 9 + .../SessionRecords/GetAuditRecord.json | 160 ++++ .../SessionRecords/GetAzureRateCard.json | 31 + .../GetAzureRateCardSharedServices.json | 31 + .../SessionRecords/GetAzureUtilization.json | 790 ++++++++++++++++++ .../GetCountryValidationRules-CN.json | 15 + .../GetCountryValidationRules-DE.json | 17 + .../GetCountryValidationRules-GB.json | 17 + .../GetCountryValidationRules-US.json | 16 + .../GetCustomerConfigurationPolicies.json | 47 ++ .../GetCustomerConfigurationPolicyById.json | 16 + .../SessionRecords/GetCustomerDevice.json | 26 + .../GetCustomerDeviceBatch.json | 21 + .../SessionRecords/GetCustomerLicense.json | 99 +++ .../GetCustomerLicenseByGroup.json | 129 +++ .../GetCustomerLicenseUser.json | 56 ++ .../GetCustomerManagedServices.json | 55 ++ .../GetCustomerSubscription.json | 85 ++ .../SessionRecords/GetCustomerUserAll.json | 54 ++ .../GetCustomerUserAllDeleted.json | 36 + .../SessionRecords/GetCustomerUserById.json | 18 + .../GetCustomerUserRoleById.json | 16 + .../SessionRecords/GetEntitlement.json | 34 + .../SessionRecords/GetIndirectResellers.json | 30 + .../SessionRecords/GetInvoice.json | 145 ++++ .../SessionRecords/GetInvoiceById.json | 65 ++ .../SessionRecords/GetInvoiceLineItem.json | 3 + .../SessionRecords/GetInvoiceSummary.json | 53 ++ .../SessionRecords/GetOfferAddon.json | 103 +++ .../GetPartnerLegalProfile.json | 42 + .../GetPartnerLicenseDeploymentInsights.json | 28 + .../GetPartnerLicensesUsageInsights.json | 58 ++ .../GetPartnerSupportProfile.json | 16 + .../SessionRecords/GetProduct.json | 540 ++++++++++++ .../GetProductAvailability.json | 35 + .../GetProductAvailabilityById.json | 20 + .../SessionRecords/GetProductByProductId.json | 21 + .../SessionRecords/GetProductInventory.json | 44 + .../SessionRecords/GetProductSku.json | 227 +++++ .../UpdatePartnerLegalProfile.json | 46 + .../UpdatePartnerSupportProfile.json | 9 + test/PowerShell.Tests/TestBase.cs | 90 ++ .../Validations/AddressValidatorTests.cs | 223 +++++ test/PowerShell.Tests/app.config | 23 + test/PowerShell.Tests/packages.config | 14 + 312 files changed, 28781 insertions(+), 16 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE/BUG_REPORT.md create mode 100644 .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 LICENSE create mode 100644 Partner-Center-PowerShell.sln create mode 100644 docs/developer-guide.md create mode 100644 docs/documentation-guide.md create mode 100644 docs/help-generation.md create mode 100644 docs/help/Add-PartnerCustomerCartLineItem.md create mode 100644 docs/help/Add-PartnerCustomerUserRoleMember.md create mode 100644 docs/help/Connect-PartnerCenter.md create mode 100644 docs/help/Get-PartnerAgreementDetail.md create mode 100644 docs/help/Get-PartnerAuditRecord.md create mode 100644 docs/help/Get-PartnerAzureRateCard.md create mode 100644 docs/help/Get-PartnerBillingProfile.md create mode 100644 docs/help/Get-PartnerCountryValidation.md create mode 100644 docs/help/Get-PartnerCustomer.md create mode 100644 docs/help/Get-PartnerCustomerAgreement.md create mode 100644 docs/help/Get-PartnerCustomerCart.md create mode 100644 docs/help/Get-PartnerCustomerConfigurationPolicy.md create mode 100644 docs/help/Get-PartnerCustomerDevice.md create mode 100644 docs/help/Get-PartnerCustomerDeviceBatch.md create mode 100644 docs/help/Get-PartnerCustomerEntitlement.md create mode 100644 docs/help/Get-PartnerCustomerLicense.md create mode 100644 docs/help/Get-PartnerCustomerLicenseDeploymentInfo.md create mode 100644 docs/help/Get-PartnerCustomerManagedService.md create mode 100644 docs/help/Get-PartnerCustomerOrder.md create mode 100644 docs/help/Get-PartnerCustomerSubscription.md create mode 100644 docs/help/Get-PartnerCustomerSubscriptionProvisioningStatus.md create mode 100644 docs/help/Get-PartnerCustomerSubscriptionRegistrationStatus.md create mode 100644 docs/help/Get-PartnerCustomerSubscriptionUpgrades.md create mode 100644 docs/help/Get-PartnerCustomerSubscriptionUtilization.md create mode 100644 docs/help/Get-PartnerCustomerTrialConversion.md create mode 100644 docs/help/Get-PartnerCustomerUser.md create mode 100644 docs/help/Get-PartnerCustomerUserRole.md create mode 100644 docs/help/Get-PartnerIndirectReseller.md create mode 100644 docs/help/Get-PartnerInvoice.md create mode 100644 docs/help/Get-PartnerInvoiceStatement.md create mode 100644 docs/help/Get-PartnerInvoiceSummary.md create mode 100644 docs/help/Get-PartnerLegalProfile.md create mode 100644 docs/help/Get-PartnerLicenseDeploymentInfo.md create mode 100644 docs/help/Get-PartnerLicenseUsageInfo.md create mode 100644 docs/help/Get-PartnerOffer.md create mode 100644 docs/help/Get-PartnerOfferAddon.md create mode 100644 docs/help/Get-PartnerOrganizationProfile.md create mode 100644 docs/help/Get-PartnerProduct.md create mode 100644 docs/help/Get-PartnerProductAvailability.md create mode 100644 docs/help/Get-PartnerProductInventory.md create mode 100644 docs/help/Get-PartnerProductSKU.md create mode 100644 docs/help/Get-PartnerResellerRequestLink.md create mode 100644 docs/help/Get-PartnerServiceIncident.md create mode 100644 docs/help/Get-PartnerServiceRequest.md create mode 100644 docs/help/Get-PartnerServiceRequestTopic.md create mode 100644 docs/help/Get-PartnerSupportProfile.md create mode 100644 docs/help/New-PartnerCustomer.md create mode 100644 docs/help/New-PartnerCustomerAgreement.md create mode 100644 docs/help/New-PartnerCustomerCart.md create mode 100644 docs/help/New-PartnerCustomerCartLineItem.md create mode 100644 docs/help/New-PartnerCustomerConfigurationPolicy.md create mode 100644 docs/help/New-PartnerCustomerOrder.md create mode 100644 docs/help/New-PartnerCustomerOrderLineItem.md create mode 100644 docs/help/New-PartnerCustomerSubscriptionRegistration.md create mode 100644 docs/help/New-PartnerCustomerUser.md create mode 100644 docs/help/PartnerCenter.md create mode 100644 docs/help/Remove-PartnerCustomerConfigurationPolicy.md create mode 100644 docs/help/Remove-PartnerCustomerUser.md create mode 100644 docs/help/Remove-PartnerCustomerUserRoleMember.md create mode 100644 docs/help/Remove-PartnerSandboxCustomer.md create mode 100644 docs/help/Restore-PartnerCustomerUser.md create mode 100644 docs/help/Set-PartnerBillingProfile.md create mode 100644 docs/help/Set-PartnerCustomer.md create mode 100644 docs/help/Set-PartnerCustomerConfigurationPolicy.md create mode 100644 docs/help/Set-PartnerCustomerSubscription.md create mode 100644 docs/help/Set-PartnerCustomerUser.md create mode 100644 docs/help/Set-PartnerLegalProfile.md create mode 100644 docs/help/Set-PartnerOrganizationProfile.md create mode 100644 docs/help/Set-PartnerSupportProfile.md create mode 100644 docs/help/Submit-PartnerCustomerCart.md create mode 100644 docs/help/Test-PartnerAddress.md create mode 100644 docs/help/Test-PartnerDomainAvailability.md create mode 100644 docs/scenarios.md create mode 100644 docs/scenarios/confirm-customer-consent.md create mode 100644 docs/scenarios/purchase-azure-reservations.md create mode 100644 src/PowerShell/Authentication/EnvironmentConstants.cs create mode 100644 src/PowerShell/Authentication/EnvironmentName.cs create mode 100644 src/PowerShell/Authentication/PartnerContext.cs create mode 100644 src/PowerShell/Authentication/PartnerEnvironment.cs create mode 100644 src/PowerShell/Authentication/PartnerProfile.cs create mode 100644 src/PowerShell/Authentication/PartnerSession.cs create mode 100644 src/PowerShell/Commands/AddPartnerCustomerCartLineItem.cs create mode 100644 src/PowerShell/Commands/AddPartnerCustomerUserRoleMember.cs create mode 100644 src/PowerShell/Commands/ConnectPartnerCenter.cs create mode 100644 src/PowerShell/Commands/GetPartnerAgreementDetail.cs create mode 100644 src/PowerShell/Commands/GetPartnerAuditRecord.cs create mode 100644 src/PowerShell/Commands/GetPartnerAzureRateCard.cs create mode 100644 src/PowerShell/Commands/GetPartnerBillingProfile.cs create mode 100644 src/PowerShell/Commands/GetPartnerCountryValidation.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomer.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerAgreement.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerCart.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerConfigurationPolicy.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerDevice.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerDeviceBatch.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerEntitlement.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerLicense.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerLicenseDeploymentInfo.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerManagedService.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerOrder.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerSubscription.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerSubscriptionProvisioningStatus.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerSubscriptionRegistrationStatus.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerSubscriptionUpgrades.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerSubscriptionUtilization.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerTrialConversion.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerUser.cs create mode 100644 src/PowerShell/Commands/GetPartnerCustomerUserRole.cs create mode 100644 src/PowerShell/Commands/GetPartnerIndirectReseller.cs create mode 100644 src/PowerShell/Commands/GetPartnerInvoice.cs create mode 100644 src/PowerShell/Commands/GetPartnerInvoiceStatement.cs create mode 100644 src/PowerShell/Commands/GetPartnerInvoiceSummary.cs create mode 100644 src/PowerShell/Commands/GetPartnerLegalProfile.cs create mode 100644 src/PowerShell/Commands/GetPartnerLicenseDeploymentInfo.cs create mode 100644 src/PowerShell/Commands/GetPartnerLicenseUsageInfo.cs create mode 100644 src/PowerShell/Commands/GetPartnerOffer.cs create mode 100644 src/PowerShell/Commands/GetPartnerOfferAddon.cs create mode 100644 src/PowerShell/Commands/GetPartnerOrganizationProfile.cs create mode 100644 src/PowerShell/Commands/GetPartnerProduct.cs create mode 100644 src/PowerShell/Commands/GetPartnerProductAvailability.cs create mode 100644 src/PowerShell/Commands/GetPartnerProductInventory.cs create mode 100644 src/PowerShell/Commands/GetPartnerProductSKU.cs create mode 100644 src/PowerShell/Commands/GetPartnerResellerRequestLink.cs create mode 100644 src/PowerShell/Commands/GetPartnerServiceIncident.cs create mode 100644 src/PowerShell/Commands/GetPartnerServiceRequest.cs create mode 100644 src/PowerShell/Commands/GetPartnerServiceRequestTopic.cs create mode 100644 src/PowerShell/Commands/GetPartnerSupportProfile.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomer.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerAgreement.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerCart.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerCartLineItem.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerConfigurationPolicy.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerOrder.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerOrderLineItem.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerSubscriptionRegistration.cs create mode 100644 src/PowerShell/Commands/NewPartnerCustomerUser.cs create mode 100644 src/PowerShell/Commands/PartnerPSCmdlet.cs create mode 100644 src/PowerShell/Commands/RemovePartnerCustomerConfigurationPolicy.cs create mode 100644 src/PowerShell/Commands/RemovePartnerCustomerUser.cs create mode 100644 src/PowerShell/Commands/RemovePartnerCustomerUserRoleMember.cs create mode 100644 src/PowerShell/Commands/RemovePartnerSandboxCustomer.cs create mode 100644 src/PowerShell/Commands/RestorePartnerCustomerUser.cs create mode 100644 src/PowerShell/Commands/SetPartnerBillingProfile.cs create mode 100644 src/PowerShell/Commands/SetPartnerCustomer.cs create mode 100644 src/PowerShell/Commands/SetPartnerCustomerConfigurationPolicy.cs create mode 100644 src/PowerShell/Commands/SetPartnerCustomerSubscription.cs create mode 100644 src/PowerShell/Commands/SetPartnerCustomerUser.cs create mode 100644 src/PowerShell/Commands/SetPartnerLegalProfile.cs create mode 100644 src/PowerShell/Commands/SetPartnerOrganizationProfile.cs create mode 100644 src/PowerShell/Commands/SetPartnerSupportProfile.cs create mode 100644 src/PowerShell/Commands/SubmitPartnerCustomerCart.cs create mode 100644 src/PowerShell/Commands/TestPartnerAddress.cs create mode 100644 src/PowerShell/Commands/TestPartnerDomainAvailability.cs create mode 100644 src/PowerShell/Common/AssertExtensions.cs create mode 100644 src/PowerShell/Common/PSPartnerException.cs create mode 100644 src/PowerShell/Common/ResourceExtensions.cs create mode 100644 src/PowerShell/Common/SecureStringExtensions.cs create mode 100644 src/PowerShell/Converts/CustomerConverter.cs create mode 100644 src/PowerShell/Factories/AuthenticationFactory.cs create mode 100644 src/PowerShell/Factories/ClientFactory.cs create mode 100644 src/PowerShell/Factories/IAuthenticationFactory.cs create mode 100644 src/PowerShell/Factories/IClientFactory.cs create mode 100644 src/PowerShell/GlobalSuppressions.cs create mode 100644 src/PowerShell/Microsoft.Store.PartnerCenter.PowerShell.format.ps1xml create mode 100644 src/PowerShell/Models/Agreements/PSAgreement.cs create mode 100644 src/PowerShell/Models/Agreements/PSAgreementMetaData.cs create mode 100644 src/PowerShell/Models/Analytics/PSCustomerLicensesDeploymentInsights.cs create mode 100644 src/PowerShell/Models/Analytics/PSCustomerLicensesInsightsBase.cs create mode 100644 src/PowerShell/Models/Analytics/PSLicensesInsightsBase.cs create mode 100644 src/PowerShell/Models/Analytics/PSPartnerLicensesDeploymentInsight.cs create mode 100644 src/PowerShell/Models/Analytics/PSPartnerLicensesUsageInsight.cs create mode 100644 src/PowerShell/Models/Auditing/PSAuditRecord.cs create mode 100644 src/PowerShell/Models/Carts/PSCart.cs create mode 100644 src/PowerShell/Models/Carts/PSCartCheckoutResult.cs create mode 100644 src/PowerShell/Models/Carts/PSCartLineItem.cs create mode 100644 src/PowerShell/Models/ConfigurationPolicies/PSConfigurationPolicy.cs create mode 100644 src/PowerShell/Models/CountryValidationRules/PSCountryValidationRules.cs create mode 100644 src/PowerShell/Models/CustomerRelationshipRequests/PSCustomerRelationshipRequest.cs create mode 100644 src/PowerShell/Models/CustomerSubscriptionUpgrades/PsCustomerSubscriptionUpgrades.cs create mode 100644 src/PowerShell/Models/CustomerTrialConversion/PSCustomerTrialConversion.cs create mode 100644 src/PowerShell/Models/CustomerUsers/PSCustomerUser.cs create mode 100644 src/PowerShell/Models/Customers/PSCustomer.cs create mode 100644 src/PowerShell/Models/DevicesDeployment/PSDevice.cs create mode 100644 src/PowerShell/Models/DevicesDeployment/PSDeviceBatch.cs create mode 100644 src/PowerShell/Models/Entitlements/PSEntitlement.cs create mode 100644 src/PowerShell/Models/Invoices/PSBaseAzureDataMarketLineItem.cs create mode 100644 src/PowerShell/Models/Invoices/PSBaseUsageBasedLineItem.cs create mode 100644 src/PowerShell/Models/Invoices/PSInvoice.cs create mode 100644 src/PowerShell/Models/Invoices/PSInvoiceLineItem.cs create mode 100644 src/PowerShell/Models/Invoices/PSInvoiceSummary.cs create mode 100644 src/PowerShell/Models/Invoices/PSLicenseBasedLineItem.cs create mode 100644 src/PowerShell/Models/Invoices/PSOneTimeInvoiceLineItem.cs create mode 100644 src/PowerShell/Models/Invoices/PSUsageBasedLineItem.cs create mode 100644 src/PowerShell/Models/Licenses/PSLicense.cs create mode 100644 src/PowerShell/Models/Licenses/PSSubscribedSku.cs create mode 100644 src/PowerShell/Models/ManagedServices/PSManagedService.cs create mode 100644 src/PowerShell/Models/Offers/PSOffer.cs create mode 100644 src/PowerShell/Models/Orders/PSOrder.cs create mode 100644 src/PowerShell/Models/Orders/PSOrderLineItem.cs create mode 100644 src/PowerShell/Models/Partners/PSBillingProfile.cs create mode 100644 src/PowerShell/Models/Partners/PSLegalBusinessProfile.cs create mode 100644 src/PowerShell/Models/Partners/PSOrganizationProfile.cs create mode 100644 src/PowerShell/Models/Partners/PSSupportProfile.cs create mode 100644 src/PowerShell/Models/Products/PSInventoryItem.cs create mode 100644 src/PowerShell/Models/Products/PSProduct.cs create mode 100644 src/PowerShell/Models/Products/PSProductAvailability.cs create mode 100644 src/PowerShell/Models/Products/PSSku.cs create mode 100644 src/PowerShell/Models/RateCards/PSAzureRateCard.cs create mode 100644 src/PowerShell/Models/Relationships/PSPartnerRelationship.cs create mode 100644 src/PowerShell/Models/Roles/PSDirectoryRole.cs create mode 100644 src/PowerShell/Models/ServiceRequests/PSServiceRequest.cs create mode 100644 src/PowerShell/Models/ServiceRequests/PSSupportTopic.cs create mode 100644 src/PowerShell/Models/Subscriptions/PSSubscription.cs create mode 100644 src/PowerShell/Models/Subscriptions/PSSubscriptionProvisioningStatus.cs create mode 100644 src/PowerShell/Models/Subscriptions/PSSubscriptionRegistrationStatus.cs create mode 100644 src/PowerShell/Models/Utilizations/PSAzureUtilizationRecord.cs create mode 100644 src/PowerShell/PartnerCenter.psd1 create mode 100644 src/PowerShell/PowerShell.csproj create mode 100644 src/PowerShell/Properties/AssemblyInfo.cs create mode 100644 src/PowerShell/Properties/Resources.Designer.cs create mode 100644 src/PowerShell/Properties/Resources.resx create mode 100644 src/PowerShell/Validations/AddressValidator.cs create mode 100644 src/PowerShell/Validations/IValidator.cs create mode 100644 src/PowerShell/Validations/ValidationException.cs create mode 100644 src/PowerShell/app.config create mode 100644 src/PowerShell/packages.config create mode 100644 test/PowerShell.Tests/Commands/AnalyticTests.cs create mode 100644 test/PowerShell.Tests/Commands/AnalyticTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/AuditRecordTests.cs create mode 100644 test/PowerShell.Tests/Commands/AuditRecordTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/Common.ps1 create mode 100644 test/PowerShell.Tests/Commands/CustomerTests.cs create mode 100644 test/PowerShell.Tests/Commands/CustomerTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/DomainTests.cs create mode 100644 test/PowerShell.Tests/Commands/DomainTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/IndirectTests.cs create mode 100644 test/PowerShell.Tests/Commands/IndirectTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/InvoiceTests.cs create mode 100644 test/PowerShell.Tests/Commands/InvoiceTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/OfferTests.cs create mode 100644 test/PowerShell.Tests/Commands/OfferTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/PartnerTests.cs create mode 100644 test/PowerShell.Tests/Commands/PartnerTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/ProductTests.cs create mode 100644 test/PowerShell.Tests/Commands/ProductTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/RateCardTests.cs create mode 100644 test/PowerShell.Tests/Commands/RateCardTests.ps1 create mode 100644 test/PowerShell.Tests/Commands/ValidationTests.cs create mode 100644 test/PowerShell.Tests/Commands/ValidationTests.ps1 create mode 100644 test/PowerShell.Tests/Converters/CustomerConverTests.cs create mode 100644 test/PowerShell.Tests/Enumerators/ResourceCollectionEnumerator.cs create mode 100644 test/PowerShell.Tests/Factories/MockAuthenticationFactory.cs create mode 100644 test/PowerShell.Tests/Factories/MockClientFactory.cs create mode 100644 test/PowerShell.Tests/Factories/OperationFactory.cs create mode 100644 test/PowerShell.Tests/PowerShell.Tests.csproj create mode 100644 test/PowerShell.Tests/PowerShellExtensions.cs create mode 100644 test/PowerShell.Tests/Properties/AssemblyInfo.cs create mode 100644 test/PowerShell.Tests/SessionRecords/AddCustomerUserRoleMember.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetAuditRecord.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetAzureRateCard.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetAzureRateCardSharedServices.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetAzureUtilization.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-CN.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-DE.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-GB.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-US.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicies.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicyById.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerDevice.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerDeviceBatch.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerLicense.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerLicenseByGroup.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerLicenseUser.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerManagedServices.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerSubscription.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerUserAll.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerUserAllDeleted.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerUserById.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetCustomerUserRoleById.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetEntitlement.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetIndirectResellers.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetInvoice.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetInvoiceById.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetInvoiceLineItem.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetInvoiceSummary.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetOfferAddon.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetPartnerLegalProfile.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetPartnerLicenseDeploymentInsights.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetPartnerLicensesUsageInsights.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetPartnerSupportProfile.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetProduct.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetProductAvailability.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetProductAvailabilityById.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetProductByProductId.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetProductInventory.json create mode 100644 test/PowerShell.Tests/SessionRecords/GetProductSku.json create mode 100644 test/PowerShell.Tests/SessionRecords/UpdatePartnerLegalProfile.json create mode 100644 test/PowerShell.Tests/SessionRecords/UpdatePartnerSupportProfile.json create mode 100644 test/PowerShell.Tests/TestBase.cs create mode 100644 test/PowerShell.Tests/Validations/AddressValidatorTests.cs create mode 100644 test/PowerShell.Tests/app.config create mode 100644 test/PowerShell.Tests/packages.config diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0ab12d8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,77 @@ +# To learn more about .editorconfig see https://aka.ms/editorconfigdocs +root = true + +# Don't use tabs for indentation. +[*] +indent_style = space +end_of_line = crlf +# (Please don't specify an indent_size here; that has too many unintended consequences.) + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 + +# Xml project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# Xml config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +# JSON files +[*.json] +indent_size = 2 + +# Dotnet code style settings: +[*.{cs, vb}] +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +# Avoid "this." and "Me." if not necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Suggest more modern language features when available +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion + +# CSharp code style settings: +[*.cs] +# Prefer "var" everywhere +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = false:suggestion +csharp_style_var_elsewhere = false:suggestion + +# Prefer method-like constructs to have a block body +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none + +# Prefer property-like constructs to have an expression-body +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Newline settings +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 0000000..5e96d8f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +# Steps to reproduce + +> What steps can reproduce the defect? +> Please share the setup, commandline for vstest.console, sample project, target +> framework etc. + +## Expected behavior + +> Share the expected output + +## Actual behavior + +> What is the behavior observed? + +## Diagnostic logs + +> Please share test platform diagnostics logs. +> The logs may contain test assembly paths, kindly review and mask those before sharing. + +## Environment + +> Please share additional details about your environment. +> Version \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 0000000..b9bec0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +# Feature Request + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I am always frustrated when [...] + +**Describe the solution you would like** +A clear and concise description of what you want to happen. + +**Describe alternatives you have considered** +A clear and concise description of any alternative solutions or features you have considered. + +**Additional context** +Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ddc7f75 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +# Description + +Please add a meaningful description for this change. Ensure the PR has required unit tests. + +## Related issue + +Kindly link any related issues (e.g. Fixes #xyz). \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d1ca00f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE \ No newline at end of file diff --git a/Partner-Center-PowerShell.sln b/Partner-Center-PowerShell.sln new file mode 100644 index 0000000..5b1acbd --- /dev/null +++ b/Partner-Center-PowerShell.sln @@ -0,0 +1,47 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2036 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AD52517F-3B47-437C-B374-8302533DECBC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{26039E3A-114C-4B28-87B9-25755134FDD0}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + .gitignore = .gitignore + LICENSE = LICENSE + README.md = README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{91C9A85A-2792-4EA1-9815-6DEEEFC2C932}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShell", "src\PowerShell\PowerShell.csproj", "{6714CA29-04A6-4D4E-919C-28AF294E6BA6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShell.Tests", "test\PowerShell.Tests\PowerShell.Tests.csproj", "{3407AFBC-72DA-491C-816F-2176D2E06DB4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6714CA29-04A6-4D4E-919C-28AF294E6BA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6714CA29-04A6-4D4E-919C-28AF294E6BA6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6714CA29-04A6-4D4E-919C-28AF294E6BA6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6714CA29-04A6-4D4E-919C-28AF294E6BA6}.Release|Any CPU.Build.0 = Release|Any CPU + {3407AFBC-72DA-491C-816F-2176D2E06DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3407AFBC-72DA-491C-816F-2176D2E06DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3407AFBC-72DA-491C-816F-2176D2E06DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3407AFBC-72DA-491C-816F-2176D2E06DB4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6714CA29-04A6-4D4E-919C-28AF294E6BA6} = {AD52517F-3B47-437C-B374-8302533DECBC} + {3407AFBC-72DA-491C-816F-2176D2E06DB4} = {91C9A85A-2792-4EA1-9815-6DEEEFC2C932} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {598D99A1-EECC-4613-AA82-FA1E915D0195} + EndGlobalSection +EndGlobal diff --git a/README.md b/README.md index a4579b6..104060a 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,88 @@ -# Introduction -TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project. +# Microsoft Partner Center PowerShell -# Getting Started -TODO: Guide users through getting your code up and running on their own system. In this section you can talk about: -1. Installation process -2. Software dependencies -3. Latest releases -4. API references +[![Build status](https://partnercenter.visualstudio.com/powershell/_apis/build/status/PowerShell%20master%20CI)](https://partnercenter.visualstudio.com/powershell/_build/latest?definitionId=0) -# Build and Test -TODO: Describe and show how to build your code and run the tests. +This repository contains a set of PowerShell cmdlets for developers and administrators to manage Cloud Solution Provider program resources. -# Contribute -TODO: Explain how other users and developers can contribute to make your code better. +## Installation -If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files: -- [ASP.NET Core](https://github.com/aspnet/Home) -- [Visual Studio Code](https://github.com/Microsoft/vscode) -- [Chakra Core](https://github.com/Microsoft/ChakraCore) \ No newline at end of file +### PowerShell Gallery + +Run the following command in an elevated PowerShell session to install the Partner Center module: + +```powershell +Install-Module -Name PartnerCenter +``` + +If you have an earlier version of the Partner Center PowerShell modules installed from the PowerShell Gallery and would like to update to the latest version, run the following commands from an elevated PowerShell session. + +**Note:** `Update-Module` installs the new version, however it does not remove the old version. + +```powershell +# Install the latest version of the Partner Center PowerShell module +Update-Module -Name PartnerCenter +``` + +## Usage + +### Configure Azure AD Native App + +**Important:** This module only supports the app + user authentication. + +You must create and configure an Azure Active Directory (AD) application. To do this, complete the following steps: + +1. Sign in to the [Partner Dashboard](https://partner.microsoft.com) using credentials that have *Admin Agent* and *Global Admin* privileges +2. Click on _Dashboard_ at the top of the page, then click on the cog icon in the upper right, and then click the _Partner settings_. +3. Add a new native application if one does not exist already. +4. Sign in to the [Azure management portal](https://portal.azure.com) using the same credentials from step 1. +5. Click on the _Azure Active Directory_ icon in the toolbar. +6. Click _App registrations_ -> Select _All apps_ from the drop down -> Click on the application created in step 3. +7. Click _Settings_ and then click _Redirect URIs_ +8. Add **urn:ietf:wg:oauth:2.0:oob** as one of the available Redirect URIs. Be sure to click the _Save_ button to ensure the changes are saved. + +### Log in to Partner Center + +To connect to Partner Center, use the [`Connect-PartnerCenter`](docs/help/Connect-PartnerCenter.md) cmdlet. + +```powershell +# Interactive login - a dialog box will appear for you to provide your Partner Center credentials +Connect-PartnerCenter -ApplicationId '' + +# Non-interactive login +$PSCredential = Get-Credential +Connect-PartnerCenter -ApplicationId '' -Credential $PSCredential +``` + +To log into a specific cloud (_ChinaCloud_, _GlobalCloud_, _GermanCloud_, _USGovernment_), use the `Environment` parameter: + +```powershell +# Log into a specific cloud - in this case, the German cloud +Connect-PartnerCenter -Environment GermanCloud +``` + +### Discovering cmdlets + +Use the `Get-Command` cmdlet to discover cmdlets within a specific module, or cmdlets that follow a specific search pattern: + +```powershell +# View all cmdlets in the PartnerCenter module +Get-Command -Module PartnerCenter + +# View all cmdlets that contain "Customer" in the PartnerCenter module +Get-Command -Module PartnerCenter -Name "*Customer*" +``` + +### Cmdlet help and examples + +To view the cmdlet help content, use the `Get-Help` cmdlet: + +```powershell +# View the basic help content for Get-PartnerCustomer +Get-Help -Name Get-PartnerCustomer + +# View the examples for Get-PartnerCustomer +Get-Help -Name Get-PartnerCustomer -Examples + +# View the full help content for Get-PartnerCustomer +Get-Help -Name Get-PartnerCustomer -Full +``` \ No newline at end of file diff --git a/docs/developer-guide.md b/docs/developer-guide.md new file mode 100644 index 0000000..381a376 --- /dev/null +++ b/docs/developer-guide.md @@ -0,0 +1,22 @@ +# Microsoft Partner Center PowerShell Developer Guide + +The Microsoft Partner Center PowerShell Developer Guide was created to help with the development and testing of Partner Center PowerShell cmdlets. This guide contains information on how to set up your environment, implement cmdlets, develop tests, and more. + +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Environment Setup](#environment-setup) + - [Documentation Basics](#documentation-basics) + - [Building the Environment](#building-the-environment) + - [Running Tests](#running-tests) + +## Prerequisites + +The following prerequisites should be completed before contributing to the source code the Partner Center PowerShell repository: + +- Install [Visual Studio 2017](https://www.visualstudio.com/downloads/) +- Install the latest version of [Git](https://git-scm.com/downloads) +- Install the [`platyPS` module](https://github.com/Azure/azure-powershell/blob/preview/documentation/development-docs/help-generation.md#installing-platyps) +- Set the PowerShell [execution policy](https://technet.microsoft.com/en-us/library/ee176961.aspx) to **Unrestricted** for the following versions of PowerShell: + - `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe` + - `C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe` \ No newline at end of file diff --git a/docs/documentation-guide.md b/docs/documentation-guide.md new file mode 100644 index 0000000..cf9a136 --- /dev/null +++ b/docs/documentation-guide.md @@ -0,0 +1,43 @@ +# Microsoft Partner Center PowerShell Documentation Guide + +The Microsoft Partner Center PowerShell Documentation Guide was created to help with the documentation of Partner Center PowerShell cmdlets. This guide contains information on how to set up your environment, generate the help files, and more. + +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Environment Setup](#environment-setup) + +## Prerequisites + +- Install [Visual Studio Code](https://code.visualstudio.com/) +- Install the latest version of [Git](https://git-scm.com/downloads) +- Install the [Docs Authoring Pack](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-authoring-pack) extension for Visual Studio Code +- Install the [VS Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare) extension for Visual Studio Code +- Install the [`platyPS` module](https://github.com/Azure/azure-powershell/blob/preview/documentation/development-docs/help-generation.md#installing-platyps) +- Set the PowerShell [execution policy](https://technet.microsoft.com/en-us/library/ee176961.aspx) to **Unrestricted** for the following versions of PowerShell: + - `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe` + - `C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe` + +## Environment Setup + +Perform the following tasks to clone the Partner Center PowerShell repository, switch to the dev branch, and then create a new branch. + +1. Open Visual Studio Code +2. Open the command palette by pressing Ctrl+Shift+P +3. Run **Git: Clone** to clone the repository. When prompted for the repository URL specify +4. When prompted select the folder where you would like the repository to stored locally + +Perform the following task to checkout the dev branch. + +1. Open the command palette by pressing Ctrl+Shift+P +2. Run **Git: Checkout too..** to checkout the *dev* branch +3. When prompted click the *dev* branch. This will checkout the branch + +Create a new branch + +1. Open the command palette by pressing Ctrl+Shift+P +2. Run **Git: Create Branch...** to create a new branch +3. When prompted specify an appropriate name for the new branch +4. Press enter to complete the creation of the branch + +It is recommended that the name of your branch reflect the work you are performing. diff --git a/docs/help-generation.md b/docs/help-generation.md new file mode 100644 index 0000000..d003646 --- /dev/null +++ b/docs/help-generation.md @@ -0,0 +1,115 @@ +# Microsoft Partner Center PowerShell Help Generation + +## Description + +Help files are generated and maintained using the [`platyPS`](https://github.com/PowerShell/platyPS) module. When the help content for a cmdlet (or multiple cmdlets) needs to be updated, users will now only have to update the contents of the markdown file, _and not the MAML file as well_. + +## Installing `platyPS` + +In order to use the cmdlets necessary to update the markdown help files (or generate MAML help locally from these markdown files), you must first install the `platyPS` module mentioned previously. + +To do so, you can can follow the below steps (which are outlined in the [**Quick start**](https://github.com/PowerShell/platyPS#quick-start) section of the `platyPS` README): + +```powershell +Install-Module -Name platyPS -Scope CurrentUser +Import-Module platyPS +``` + +**Note:** this module will need to be installed from the [PowerShell Gallery](http://www.powershellgallery.com/). If, for some reason, this isn't a registered repository when running the `Get-PSRepository` cmdlet, then you will need to register it by running the following command: + +```powershell +Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/ +``` + +## Using `platyPS` + +### Importing your module + +Before you run the `platyPS` cmdlets to update your markdown help files, you will need to first import the module containing the changes that you have made to your cmdlets into your current PowerShell session. Once you have built your project (either through Visual Studio or with `msbuild`), you can locate the `PartnerCenter.psd1` module manifest in the `src\PowerShell\bin\Debug` folder of your local repository. + +You can import it in your current PowerShell session by running the following command: + +```powershell +$PathToModuleManifest = ".\src\PowerShell\bin\Debug\PartnerCenter.psd1" +Import-Module -Name $PathToModuleManifest +``` + +**Note**: if you do not see all of the changes you made to the cmdlets in your markdown files (_e.g.,_ a cmdlet you deleted is still appearing), you may need to delete any existing Partner Center PowerShell modules that you have on your machine (installed either through the PowerShell Gallery or by Web Platform Installer) before you import your module. + +### Creating a help file for a new cmdlet + +To create the appropriate help file for a new cmdlet, use the [`New-MarkdownHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/New-MarkdownHelp.md) cmdlet: + +```powershell +$PathToModuleManifest = ".\src\PowerShell\bin\Debug\PartnerCenter.psd1" # Full path to the module manifest that you have updated +Import-Module -Name $PathToModuleManifest + +$PathToHelpFolder = ".\docs\help\" # Full path to help folder containing markdown files to be updated +$CmdletName = "" # Name of cmdlet +New-MarkdownHelp -Command $CmdletName -OutputFolder $PathToHelpFolder -AlphabeticParamsOrder +``` + +### Updating help after making cmdlet changes + +Whenever the public interface for a cmdlet has changed, the corresponding markdown file for that cmdlet will need to be updated to reflect the changes. Public interface changes include the following: + +- Add/change/remove parameter set +- Add/remove parameter +- Change attribute of a parameter + - Type + - Parameter set(s) + - Aliases + - Mandatory + - Position + - Accept pipeline input +- Add/change output type + +#### Updating all markdown files in a module + +To update all of the markdown files for a single module, use the [`Update-MarkdownHelpModule`](https://github.com/PowerShell/platyPS/blob/master/docs/Update-MarkdownHelpModule.md) cmdlet: + +```powershell +$PathToModuleManifest = ".\src\PowerShell\bin\Debug\PartnerCenter.psd1" # Full path to the module manifest that you have updated +Import-Module -Name $PathToModuleManifest + +$PathToHelpFolder = ".\docs\help\" # Full path to help folder containing markdown files to be updated +Update-MarkdownHelpModule -Path $PathToHelpFolder -RefreshModulePage -AlphabeticParamsOrder +``` + +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 with any added or removed cmdlets. + +#### Updating a single markdown file + +To update a single markdown file with the changes made to the corresponding cmdlet, use the [`Update-MarkdownHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/Update-MarkdownHelp.md) cmdlet: + +```powershell +$PathToModuleManifest = ".\src\PowerShell\bin\Debug\PartnerCenter.psd1" # Full path to the module manifest that you have updated +Import-Module -Name $PathToModuleManifest + +$PathToMarkdownFile = "../../.md" # Full path to the markdown file to be updated +Update-MarkdownHelp -Path $PathToMarkdownFile -AlphabeticParamsOrder +``` + +#### Generating and viewing the MAML help + +During the build, the MAML help will be generated from the markdown files in the repository. If you would like to generate the MAML help and preview what the help content will look like for each of your cmdlets, you can do so with two more commands. + +To generate the MAML help based on the contents of your markdown files, use the [`New-ExternalHelp`](https://github.com/PowerShell/platyPS/blob/master/docs/New-ExternalHelp.md) cmdlet: + +```powershell +$PathToHelpFolder = ".\docs\help\" # Full path to help folder containing markdown files to be updated +$PathToOutputFolder = ".\src\PowerShell\bin\Debug\" # Full path to folder where you want the MAML file to be generated +New-ExternalHelp -Path $PathToHelpFolder -OutputPath $PathToOutputFolder +``` + +To preview the help that you just generated, use the [`Get-HelpPreview`](https://github.com/PowerShell/platyPS/blob/master/docs/Get-HelpPreview.md) cmdlet: + +```powershell +$PathToMAML = ".\src\PowerShell\bin\Debug\Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml" # Full path to the MAML file that was generated + +# Save the help locally +$help = Get-HelpPreview -Path $PathToMAML + +# Get the help for a specific cmdlet +$help | where { $_.Name -eq "" } +``` \ No newline at end of file diff --git a/docs/help/Add-PartnerCustomerCartLineItem.md b/docs/help/Add-PartnerCustomerCartLineItem.md new file mode 100644 index 0000000..65f63b8 --- /dev/null +++ b/docs/help/Add-PartnerCustomerCartLineItem.md @@ -0,0 +1,124 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Add-PartnerCustomerCartLineItem + +## SYNOPSIS +Adds a new line item to the specified cart. + +## SYNTAX + +``` +Add-PartnerCustomerCartLineItem -CartId -CustomerId -LineItem [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Adds a new line item to the specified cart. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> $lineItem = New-PartnerCustomerCartLineItem -BillingCycle 'OneTime' -CatalogItemId 'DG7GMGF0DWTL:0001:DG7GMGF0DSJB' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -FriendlyName 'Sample RI Purchase' -ProvisioningContext ${duration='1Year', scope='shared', subscriptionId='b35d5324-df8e-4306-9023-6edac2d4896c'} -Quantity 10 +PS C:\> Add-PartnerCustomerCartLineItem -CartId '65faf57b-0205-47ee-92b3-08dcf233ea73' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -LineItem $lineItem +``` + +Adds a new line item to the specified cart. + +## PARAMETERS + +### -CartId +The identifier for the cart. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LineItem +The line item to be added. + +```yaml +Type: PSCartLineItem +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Carts.PSCart + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Add-PartnerCustomerUserRoleMember.md b/docs/help/Add-PartnerCustomerUserRoleMember.md new file mode 100644 index 0000000..db8a971 --- /dev/null +++ b/docs/help/Add-PartnerCustomerUserRoleMember.md @@ -0,0 +1,92 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Add-PartnerCustomerUserRoleMember + +## SYNOPSIS +Adds a customer user to a specified role. + +## SYNTAX + +``` +Add-PartnerCustomerUserRoleMember -CustomerId [-UserId ] [-RoleId ] + [] +``` + +## DESCRIPTION +The Add-PartnerCustomerUserRoleMember cmdlet adds a specified role to the target customer user. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Add-PartnerCustomerUserRoleMember -CustomerId c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2 -UserId 17765f05-723c-4be4-89e2-c7d1cdbb0906 -RoleId 62e90394-69f5-4237-9190-012177145e10 +``` + +Adds the specified user with the identifier of 17765f05-723c-4be4-89e2-c7d1cdbb0906 to the role with the identifier of 62e90394-69f5-4237-9190-012177145e10. + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RoleId +Identifier for the role. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +Identifier for the customer user. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Connect-PartnerCenter.md b/docs/help/Connect-PartnerCenter.md new file mode 100644 index 0000000..6bfdabd --- /dev/null +++ b/docs/help/Connect-PartnerCenter.md @@ -0,0 +1,103 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Connect-PartnerCenter + +## SYNOPSIS +Connect to Partner Center with an authenticated account for use with cmdlet requests. + +## SYNTAX + +``` +Connect-PartnerCenter -ApplicationId [-Credential ] [-Environment ] + [] +``` + +## DESCRIPTION +The Connect-PartnerCenter cmdlet connects to Partner Center with an authenticated account for use with cmdlet requests + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Connect-PartnerCenter -ApplicationId c4d99f39-a917-4d70-8fdb-0ad839ac0524 +``` + +Connect to Partner Center using the specified application identifier during authentication. + +### Example 2 + +```powershell +PS C:\> $cred = Get-Credential +PS C:\> Connect-PartnerCenter -ApplicationId c4d99f39-a917-4d70-8fdb-0ad839ac0524 -Credential $cred +``` + +Connect to Partner Center using the specified application identifier during authentication. + +## PARAMETERS + +### -ApplicationId +The application identifier used to access the Partner Center API. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credential +User credentials to be used when connecting to Partner Center. + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Environment +Name of the environment containing the account to log into + +```yaml +Type: EnvironmentName +Parameter Sets: (All) +Aliases: EnvironmentName +Accepted values: GlobalCloud, ChinaCloud, GermanCloud, USGovernment + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Authentication.PartnerContext + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerAgreementDetail.md b/docs/help/Get-PartnerAgreementDetail.md new file mode 100644 index 0000000..46bca26 --- /dev/null +++ b/docs/help/Get-PartnerAgreementDetail.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerAgreementDetail + +## SYNOPSIS +Gets the agreement metadata for the Microsoft Cloud Agreement. + +## SYNTAX + +``` +Get-PartnerAgreementDetail [] +``` + +## DESCRIPTION +Retrieves agreement metadata for the Microsoft Cloud Agreement. This operation is currently supported by Partner Center in the Microsoft public cloud only. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerAgreementDetail +``` + +Gets the agreement metadata for the Microsoft Cloud Agreement. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Agreements.PSAgreementMetaData + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerAuditRecord.md b/docs/help/Get-PartnerAuditRecord.md new file mode 100644 index 0000000..70119a7 --- /dev/null +++ b/docs/help/Get-PartnerAuditRecord.md @@ -0,0 +1,76 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerAuditRecord + +## SYNOPSIS +Retrieves audit records from Partner Center. + +## SYNTAX + +``` +Get-PartnerAuditRecord [-EndDate ] [-StartDate ] [] +``` + +## DESCRIPTION +Retrieves audit records for the previous 30 days from the current date, or for a date range specified by including the start date and/or the end date. Note, however, that for performance reasons activity log data availability is limited to the previous 90 days. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerAuditRecord -Start (Get-Date).AddDays(-89) +``` + +Gets the audit records from Partner Center for the past 89 days. + +## PARAMETERS + +### -EndDate +The end date of the audit record logs. + +```yaml +Type: DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StartDate +The start date of the audit record logs. + +```yaml +Type: DateTime +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Auditing.PSAuditRecord + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerAzureRateCard.md b/docs/help/Get-PartnerAzureRateCard.md new file mode 100644 index 0000000..e52f4f8 --- /dev/null +++ b/docs/help/Get-PartnerAzureRateCard.md @@ -0,0 +1,100 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerAzureRateCard + +## SYNOPSIS +Gets real-time prices for an Azure offer. + +## SYNTAX + +``` +Get-PartnerAzureRateCard [-Currency ] [-Region ] [-SharedServices] [] +``` + +## DESCRIPTION +Gets real-time prices for an Azure offer. Azure pricing is quite dynamic and changes frequently. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> $rateCard = Get-PartnerAzureRateCard +PS C:\> $rateCard.Meters +``` + +Gets real-time prices for an Azure offer. + +### Example 2 +```powershell +PS C:\> $rateCard = Get-PartnerAzureRateCard -SharedServices +PS C:\> $rateCard.Meters +``` + +Gets real-time prices for an Azure offer available through Azure Partner Shared Services (APSS). + +## PARAMETERS + +### -Currency +An optional three letter ISO code for the currency in which the resource rates will be provided. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Region +An optional two-letter ISO country/region code that indicates the market where the offer is purchased. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SharedServices +Flag indicating whether or not to retrieve the Azure Rate Card for Azure Partner Shared Services (APSS). + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.RateCards.PSAzureRateCard + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerBillingProfile.md b/docs/help/Get-PartnerBillingProfile.md new file mode 100644 index 0000000..fc33f29 --- /dev/null +++ b/docs/help/Get-PartnerBillingProfile.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerBillingProfile + +## SYNOPSIS +Gets the partner's billing profile. + +## SYNTAX + +``` +Get-PartnerBillingProfile [] +``` + +## DESCRIPTION +Gets the partner's billing profile. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerBillingProfile +``` + +Gets the partner's billing profile. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSBillingProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCountryValidation.md b/docs/help/Get-PartnerCountryValidation.md new file mode 100644 index 0000000..3fe5723 --- /dev/null +++ b/docs/help/Get-PartnerCountryValidation.md @@ -0,0 +1,62 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCountryValidation + +## SYNOPSIS +Gets the rules for validating an address for a specific country. + +## SYNTAX + +``` +Get-PartnerCountryValidation -CountryCode [] +``` + +## DESCRIPTION +Gets the rules for validating an address for a specific country. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Get-PartnerCountryValidation -CountryCode US +``` + +Gets the rules for validating an address for the United States. + +## PARAMETERS + +### -CountryCode +The country code code in ISO2 format. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CountryValidationRules.PSCountryValidationRules + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomer.md b/docs/help/Get-PartnerCustomer.md new file mode 100644 index 0000000..19cb46c --- /dev/null +++ b/docs/help/Get-PartnerCustomer.md @@ -0,0 +1,68 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomer + +## SYNOPSIS +Gets a specific customer or a list of available customers. + +## SYNTAX + +``` +Get-PartnerCustomer [[-CustomerId] ] [] +``` + +## DESCRIPTION +The Get-PartnerCustomer cmdlet gets a specific customer or a list of customers from Partner Center. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomer +``` + +Gets a list of all available customers from Partner Center. + +### Example 2 +```powershell +PS C:\> Get-PartnerCustomer -CustomerId '2ca7de6c-c05c-46b5-b689-32e53573a97a' +``` + +Gets the customer with the identifier of 2ca7de6c-c05c-46b5-b689-32e53573a97a from Partner Center. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 0 +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerAgreement.md b/docs/help/Get-PartnerCustomerAgreement.md new file mode 100644 index 0000000..700628c --- /dev/null +++ b/docs/help/Get-PartnerCustomerAgreement.md @@ -0,0 +1,61 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerAgreement + +## SYNOPSIS +Retrieves confirmation of customer acceptance provided previously. + +## SYNTAX + +``` +Get-PartnerCustomerAgreement -CustomerId [] +``` + +## DESCRIPTION +Retrieves confirmation of customer acceptance provided previously. This operation is currently supported by Partner Center in the Microsoft public cloud only. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerAgreement -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Retrieves confirmation of customer acceptance provided previously. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Agreements.PSAgreement + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerCart.md b/docs/help/Get-PartnerCustomerCart.md new file mode 100644 index 0000000..36ebbd1 --- /dev/null +++ b/docs/help/Get-PartnerCustomerCart.md @@ -0,0 +1,76 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerCart + +## SYNOPSIS +Gets a specific cart for the specified partner. + +## SYNTAX + +``` +Get-PartnerCustomerCart -CartId -CustomerId [] +``` + +## DESCRIPTION +The Get-PartnerCustomerCart cmdlet will get a specific cart for the specified partner. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerCart -CartId 'b4c8fdea-cbe4-4d17-9576-13fcacbf9605' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Gets the cart with the identifier of b4c8fdea-cbe4-4d17-9576-13fcacbf9605 that belongs to the customer with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08. + +## PARAMETERS + +### -CartId +The identifier for the cart. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Carts.PSCart + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerConfigurationPolicy.md b/docs/help/Get-PartnerCustomerConfigurationPolicy.md new file mode 100644 index 0000000..bbc75a5 --- /dev/null +++ b/docs/help/Get-PartnerCustomerConfigurationPolicy.md @@ -0,0 +1,76 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerConfigurationPolicy + +## SYNOPSIS +Gets a list of all of a customer's policies. + +## SYNTAX + +``` +Get-PartnerCustomerConfigurationPolicy [-CustomerId] [-PolicyId ] [] +``` + +## DESCRIPTION +Gets a list of all of a customer's policies. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerConfigurationPolicy -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Gets a list of all of a customer's policies. + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyId +Identifier for the configuration policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.PSConfigurationPolicy + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerDevice.md b/docs/help/Get-PartnerCustomerDevice.md new file mode 100644 index 0000000..3a15e03 --- /dev/null +++ b/docs/help/Get-PartnerCustomerDevice.md @@ -0,0 +1,77 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerDevice + +## SYNOPSIS +Gets a list of devices in the specified device batch for the specified customer. + +## SYNTAX + +``` +Get-PartnerCustomerDevice [-CustomerId] -BatchId [] +``` + +## DESCRIPTION +Gets a list of devices in the specified device batch for the specified customer. Each device resource contains details about the device. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Get-PartnerCustomerDevice -CustomerId -BatchId +``` + +This example returns a list of devices in the specified device batch for the specified customer. + +## PARAMETERS + +### -BatchId +Identifier for the device batch. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment.PSDevice + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerDeviceBatch.md b/docs/help/Get-PartnerCustomerDeviceBatch.md new file mode 100644 index 0000000..1444d7b --- /dev/null +++ b/docs/help/Get-PartnerCustomerDeviceBatch.md @@ -0,0 +1,62 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerDeviceBatch + +## SYNOPSIS +Gets a list of device batches for the specified customer identifier. + +## SYNTAX + +``` +Get-PartnerCustomerDeviceBatch [-CustomerId] [] +``` + +## DESCRIPTION +Gets a list of device batches for the specified customer identifier. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Get-PartnerCustomerDeviceBatch -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Gets a list of device batches for the specified customer identifier. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment.PSDeviceBatch + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerEntitlement.md b/docs/help/Get-PartnerCustomerEntitlement.md new file mode 100644 index 0000000..4fb388a --- /dev/null +++ b/docs/help/Get-PartnerCustomerEntitlement.md @@ -0,0 +1,78 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerEntitlement + +## SYNOPSIS +Gets a collection of entitlements. + +## SYNTAX + +``` +Get-PartnerCustomerEntitlement -CustomerId [-OrderId ] [] +``` + +## DESCRIPTION +An entitlement represents the customer's right to use a product (service). It should be consumed by service providers as the source of truth regarding the customer's right to a service. The entitlement state changes based on information received from a variety of sources, for example, subscription events. A customer may stop paying, upgrade, etc, which results in changes to the entitlement fraud. The Commerce platform may rescind an entitlement due to fraud. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerEntitlements -CustomerId c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2 +``` + +Return customer entitlements based on customer identifier. + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrderId +Identifier for the order. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Entitlements.PSEntitlement + +## NOTES + +## RELATED LINKS + + diff --git a/docs/help/Get-PartnerCustomerLicense.md b/docs/help/Get-PartnerCustomerLicense.md new file mode 100644 index 0000000..aa89a76 --- /dev/null +++ b/docs/help/Get-PartnerCustomerLicense.md @@ -0,0 +1,98 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerLicense + +## SYNOPSIS +Get a list of licenses available for a customer that are assigned or can be assigned to a user. + +## SYNTAX + +### ByCustomerId (Default) +``` +Get-PartnerCustomerLicense -CustomerId [-LicenseGroupId ] [] +``` + +### ByUserId +``` +Get-PartnerCustomerLicense -CustomerId [-UserId ] [] +``` + +## DESCRIPTION +The Get-PartnerCustomerLicense cmdlet returns a list of subscribed skus (licenses) that a customer has subscribed to and can be filtered by a LicenseGroupId (Group1: License group for AAD, Group2: License group for Minecraft, None: Both AAD and minecraft skus). Alternatively, you can get a list of licenses assigned to a specific user by specifying the user id. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerLicense -CustomerId c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2 +``` + +Return a list a available licenses for the specified customer. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LicenseGroupId +The identifier for the license group. + +```yaml +Type: LicenseGroupId +Parameter Sets: ByCustomerId +Aliases: +Accepted values: None, Group1, Group2 + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +The identifier for the user. + +```yaml +Type: String +Parameter Sets: ByUserId +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSSubscribedSku + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerLicenseDeploymentInfo.md b/docs/help/Get-PartnerCustomerLicenseDeploymentInfo.md new file mode 100644 index 0000000..c14c29c --- /dev/null +++ b/docs/help/Get-PartnerCustomerLicenseDeploymentInfo.md @@ -0,0 +1,61 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerLicenseDeploymentInfo + +## SYNOPSIS +Gets aggregated data on deployment for a specified customer. + +## SYNTAX + +``` +Get-PartnerCustomerLicenseDeploymentInfo -CustomerId [] +``` + +## DESCRIPTION +Gets aggregated data on deployment for a specified customer. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerLicenseDeploymentInfo -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 +``` + +Gets aggregated data on deployment for the customer with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics.PSCustomerLicensesDeploymentInsights + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerManagedService.md b/docs/help/Get-PartnerCustomerManagedService.md new file mode 100644 index 0000000..661c8a1 --- /dev/null +++ b/docs/help/Get-PartnerCustomerManagedService.md @@ -0,0 +1,83 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerManagedService + +## SYNOPSIS +Gets the managed services for a customer. + +## SYNTAX + +``` +Get-PartnerCustomerManagedService [-CustomerId] [-ManagedServiceId ] [] +``` + +## DESCRIPTION +Gets the managed services for a customer. In other words, get links to all of the customer's subscriptions for which you have delegated admin privileges. You can use these links to provide support and file service requests with Microsoft. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerManagedService 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 +``` + +Gets the managed services for the customer with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08. + +### Example 2 +```powershell +PS C:\> Get-PartnerCustomerManagedService -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -ManagedServiceId Exchange +``` + +Gets the Exchange managed services for the customer with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08. + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ManagedServiceId +A string that identifies the managed service. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.ManagedServices.PSManagedService + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerOrder.md b/docs/help/Get-PartnerCustomerOrder.md new file mode 100644 index 0000000..312ee14 --- /dev/null +++ b/docs/help/Get-PartnerCustomerOrder.md @@ -0,0 +1,110 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerOrder + +## SYNOPSIS +Gets either a specific order or a list of order for the specified customer. + +## SYNTAX + +### ByCustomerId +``` +Get-PartnerCustomerOrder -CustomerId [] +``` + +### ByOrderId +``` +Get-PartnerCustomerOrder -CustomerId -OrderId [] +``` + +### ByBillingCycle +``` +Get-PartnerCustomerOrder -CustomerId -BillingCycle [] +``` + +## DESCRIPTION +Gets either a specific order or a list of order for the specified customer. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerOrder -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -BillingCycleType Monthly +``` + +Gets the list of orders with a billing cycle type of monthly for the specified customer. + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerOrder -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 +``` + +Gets the list of orders for the specified customer. + +## PARAMETERS + +### -BillingCycle +Indicates the type of billing cycle. + +```yaml +Type: BillingCycleType +Parameter Sets: ByBillingCycle +Aliases: +Accepted values: Annual, Monthly, None, OneTime, Unknown + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrderId +Identifier for the order. + +```yaml +Type: String +Parameter Sets: ByOrderId +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Orders.PSOrder + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerSubscription.md b/docs/help/Get-PartnerCustomerSubscription.md new file mode 100644 index 0000000..227b6e0 --- /dev/null +++ b/docs/help/Get-PartnerCustomerSubscription.md @@ -0,0 +1,104 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerSubscription + +## SYNOPSIS +Gets a list or a single customer subscription. + +## SYNTAX + +### Customer (Default) +``` +Get-PartnerCustomerSubscription -CustomerId [-SubscriptionId ] [] +``` + +### CustomerObject +``` +Get-PartnerCustomerSubscription -InputObject [-SubscriptionId ] [] +``` + +## DESCRIPTION +Gets a list or a single customer subscription. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerSubscription -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 +``` + +Gets a list of subscriptions for the specified customer. + +### Example 2 +```powershell +PS C:\> Get-PartnerCustomerSubscription -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -SubscriptionId a2138cdf-769e-45d3-b957-ae9864b82bf6 +``` + +Gets the specified customer subscription. + +## PARAMETERS + +### -CustomerId +The customer identifier used to scope the request. + +```yaml +Type: String +Parameter Sets: Customer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The customer object used to scope the request. + +```yaml +Type: PSCustomer +Parameter Sets: CustomerObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription identifier used to scope the request. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + +## OUTPUTS + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions.PSSubscription + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerSubscriptionProvisioningStatus.md b/docs/help/Get-PartnerCustomerSubscriptionProvisioningStatus.md new file mode 100644 index 0000000..07373d9 --- /dev/null +++ b/docs/help/Get-PartnerCustomerSubscriptionProvisioningStatus.md @@ -0,0 +1,78 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerSubscriptionProvisioningStatus + +## SYNOPSIS +Gets the provisioning status for the specified subscription. + +## SYNTAX + +``` +Get-PartnerCustomerSubscriptionProvisioningStatus -CustomerId -SubscriptionId + [] +``` + +## DESCRIPTION +Gets the provisioning status for the specified subscription. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Get-PartnerCustomerSubscriptionProvisioningStatus -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -SubscriptionId 9fccd1b5-ffc4-4e63-ba13-4689776c020e +``` + +Gets the provisioning status for the specified subscription. + +## PARAMETERS + +### -CustomerId +The identifier of the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The identifier of the subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions.PSSubscriptionProvisioningStatus + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerSubscriptionRegistrationStatus.md b/docs/help/Get-PartnerCustomerSubscriptionRegistrationStatus.md new file mode 100644 index 0000000..f145171 --- /dev/null +++ b/docs/help/Get-PartnerCustomerSubscriptionRegistrationStatus.md @@ -0,0 +1,77 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerSubscriptionRegistrationStatus + +## SYNOPSIS +Gets the subscription registration status. + +## SYNTAX + +``` +Get-PartnerCustomerSubscriptionRegistrationStatus -CustomerId -SubscriptionId + [] +``` + +## DESCRIPTION +To purchase an Azure Reserved VM Instance using the Partner Center API, you must have at least one existing CSP Azure subscription. This cmdlet will get the registration status of the specified subscription. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerSubscriptionRegistrationStatus -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -SubscriptionId 9fccd1b5-ffc4-4e63-ba13-4689776c020e +``` + +Get the registration status for the specified subscription. + +## PARAMETERS + +### -CustomerId +The identifier of the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The identifier of the subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions.PSSubscriptionRegistrationStatus + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerSubscriptionUpgrades.md b/docs/help/Get-PartnerCustomerSubscriptionUpgrades.md new file mode 100644 index 0000000..f58eabe --- /dev/null +++ b/docs/help/Get-PartnerCustomerSubscriptionUpgrades.md @@ -0,0 +1,76 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerSubscriptionUpgrades + +## SYNOPSIS +Gets the available upgrade offers for the specified subscription. + +## SYNTAX + +``` +Get-PartnerCustomerSubscriptionUpgrades -CustomerId -SubscriptionId [] +``` + +## DESCRIPTION +Gets the available upgrade offers for the specified subscription. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerSubscriptionUpgrades -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -SubscriptionId 'b2f26801-2849-4fb1-8815-ad5fcd81143d' +``` + +Gets the available upgrade offers for the specified subscription. + +## PARAMETERS + +### -CustomerId +The identifier of the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The identifier of the subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerSubscriptionUpgrades.PSCustomerSubscriptionUpgrades + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerSubscriptionUtilization.md b/docs/help/Get-PartnerCustomerSubscriptionUtilization.md new file mode 100644 index 0000000..d2bc304 --- /dev/null +++ b/docs/help/Get-PartnerCustomerSubscriptionUtilization.md @@ -0,0 +1,143 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerSubscriptionUtilization + +## SYNOPSIS +Gets the utilization of a customer's Azure subscription. + +## SYNTAX + +``` +Get-PartnerCustomerSubscriptionUtilization -CustomerId [-EndDate ] + [-Granularity ] [-ShowDetails] -StartDate + -SubscriptionId [] +``` + +## DESCRIPTION +Gets the utilization of a customer's Azure subscription with a daily or hourly granularity. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Get-PartnerCustomerSubscriptionUtilization -CustomerId -SubscriptionId -StartDate (Get-Date).AddDays(-2).ToUniversalTime() -Granularity Hourly -ShowDetails +``` + +Gets a customer's Azure utilization for a specific subscription from a start date (specified in UTC) with an hourly granularity. + +## PARAMETERS + +### -CustomerId +The identifier of the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EndDate +The end date (in UTC) of the usages to filter. + +```yaml +Type: DateTimeOffset +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Granularity + +The resource usage time granularity. +Can either be daily or hourly. +The default value is daily + +```yaml +Type: AzureUtilizationGranularity +Parameter Sets: (All) +Aliases: +Accepted values: Daily, Hourly + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShowDetails +Flag indicating whether or not utilization records will be aggregated on the resource level + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StartDate +The start date (in UTC) of the usages to filter. + +```yaml +Type: DateTimeOffset +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The identifier of subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Utilizations.PSAzureUtilizationRecord + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerTrialConversion.md b/docs/help/Get-PartnerCustomerTrialConversion.md new file mode 100644 index 0000000..197e30d --- /dev/null +++ b/docs/help/Get-PartnerCustomerTrialConversion.md @@ -0,0 +1,76 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerTrialConversion + +## SYNOPSIS +Gets a list of trial conversions available for the specified subscription. + +## SYNTAX + +``` +Get-PartnerCustomerTrialConversion -CustomerId -SubscriptionId [] +``` + +## DESCRIPTION +Gets a list of trial conversions available for the specified subscription. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerTrialConversion -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -SubscriptionId 4eaffa18-12f6-441e-b16d-cc9f4a90cfb8 +``` + +Gets a list of trial conversions available for the specified subscription. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The identifier for the subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerTrialConversion.PSCustomerTrialConversion + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerUser.md b/docs/help/Get-PartnerCustomerUser.md new file mode 100644 index 0000000..a78f9d1 --- /dev/null +++ b/docs/help/Get-PartnerCustomerUser.md @@ -0,0 +1,131 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerUser + +## SYNOPSIS +Gets a list of all customer users or a specified user for the tenant. + +## SYNTAX + +### ByCustomerId (Default) +``` +Get-PartnerCustomerUser [-CustomerId] [-ReturnDeletedUsers] [] +``` + +### ByUserId +``` +Get-PartnerCustomerUser [-CustomerId] -UserId [] +``` + +### ByUpn +``` +Get-PartnerCustomerUser [-CustomerId] -UserPrincipalName [] +``` + +## DESCRIPTION +The Get-PartnerCustomerUser cmdlet returns either a list of customer users based on the specified customer identifier, or it returns a specific user based on the specified user identifier or user principal name. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerUser -CustomerId 45916f92-e9c3-4ed2-b8c2-d87aa129905f +``` + +Gets a list of all active users for the specified customer identifier. + +### Example 2 +```powershell +PS C:\> Get-PartnerCustomerUser -CustomerId 45916f92-e9c3-4ed2-b8c2-d87aa129905f -UserId e2e56b09-aac5-4685-947d-29e735ee7ed7 +``` + +Gets information for the specified user. + +### Example 3 +```powershell +PS C:\> Get-PartnerCustomerUser -CustomerId 45916f92-e9c3-4ed2-b8c2-d87aa129905f -ReturnDeletedUsers +``` + +Gets a list of all deleted users for the specific customer. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnDeletedUsers +Specifies whether to show deleted users. + +```yaml +Type: SwitchParameter +Parameter Sets: ByCustomerId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +The identifier for the user. + +```yaml +Type: String +Parameter Sets: ByUserId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserPrincipalName +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: ByUpn +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerCustomerUserRole.md b/docs/help/Get-PartnerCustomerUserRole.md new file mode 100644 index 0000000..e483aee --- /dev/null +++ b/docs/help/Get-PartnerCustomerUserRole.md @@ -0,0 +1,83 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerCustomerUserRole + +## SYNOPSIS +Gets a list of directory roles for a customer. + +## SYNTAX + +``` +Get-PartnerCustomerUserRole -CustomerId [-UserId ] [] +``` + +## DESCRIPTION +Gets a list of directory roles for a customer. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerCustomerUserRole -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Gets a list of directory roles for a customer. + +### Example 2 +```powershell +PS C:\> Get-PartnerCustomerUserRole -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -UserId '8e873002-9c5e-4cb5-928a-cbc14f51c398' +``` + +Gets a list of directory roles assigned to the specified user. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +Identifier for the user. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.DirectoryRoles.PSDirectoryRole + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerIndirectReseller.md b/docs/help/Get-PartnerIndirectReseller.md new file mode 100644 index 0000000..1bbe9ef --- /dev/null +++ b/docs/help/Get-PartnerIndirectReseller.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerIndirectReseller + +## SYNOPSIS +Gets a list of indirect resellers. + +## SYNTAX + +``` +Get-PartnerIndirectReseller [] +``` + +## DESCRIPTION +Gets a list of indirect resellers. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerIndirectReseller +``` + +Gets a list of indirect resellers. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Relationships.PSPartnerRelationship + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerInvoice.md b/docs/help/Get-PartnerInvoice.md new file mode 100644 index 0000000..2a113fc --- /dev/null +++ b/docs/help/Get-PartnerInvoice.md @@ -0,0 +1,69 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerInvoice + +## SYNOPSIS +Gets a list of invoices available to the partner. + +## SYNTAX + +``` +Get-PartnerInvoice [-InvoiceId ] [] +``` + +## DESCRIPTION + +Gets a specific invoice or all invoices for the authenticated partner. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerInvoice -InvoiceID 'G000024135' +``` + +Gets a specific invoice based for the specified invoice. + +### Example 2 +```powershell +PS C:\> Get-PartnerInvoice +``` + +Gets a list of invoices available to the partner. + +## PARAMETERS + +### -InvoiceId +The identifier for the invoice. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices.PSInvoice + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerInvoiceStatement.md b/docs/help/Get-PartnerInvoiceStatement.md new file mode 100644 index 0000000..1f1e6f9 --- /dev/null +++ b/docs/help/Get-PartnerInvoiceStatement.md @@ -0,0 +1,90 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerInvoiceStatement + +## SYNOPSIS +Retrieves an invoice statement using the invoice identifier. + +## SYNTAX + +``` +Get-PartnerInvoiceStatement -InvoiceId [-OutputPath ] [-Overwrite] [] +``` + +## DESCRIPTION +Retrieves an invoice statement using the invoice identifier and writes it to the specified path. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerInvoiceStatement -InvoiceId G000024135 -OutputPath 'C:\Invoices\' +``` + +Downloads the invoice statement associated with the invoice with the identifier of G000024135. + +## PARAMETERS + +### -InvoiceId +The invoice id of the statement to retrieve. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OutputPath +The output path of the PDF statement file. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Overwrite +A flag indiciating whether or to overwrite the file if it exists. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +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 + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerInvoiceSummary.md b/docs/help/Get-PartnerInvoiceSummary.md new file mode 100644 index 0000000..655bcc3 --- /dev/null +++ b/docs/help/Get-PartnerInvoiceSummary.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerInvoiceSummary + +## SYNOPSIS +Gets a summary view of the invoice. + +## SYNTAX + +``` +Get-PartnerInvoiceSummary [] +``` + +## DESCRIPTION +Gets an invoice summary that shows the balance and total charges of both recurring and one-time charges. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerInvoiceSummary +``` + +Gets a summary view of the invoice. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices.PSInvoiceSummary + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerLegalProfile.md b/docs/help/Get-PartnerLegalProfile.md new file mode 100644 index 0000000..5156b41 --- /dev/null +++ b/docs/help/Get-PartnerLegalProfile.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerLegalProfile + +## SYNOPSIS +Gets the partner legal business profile from Partner Center. + +## SYNTAX + +``` +Get-PartnerLegalProfile [] +``` + +## DESCRIPTION +The Get-PartnerLegalProfile cmdlet gets the partner legal business profile from Partner Center. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerLegalProfile +``` + +Gets the partner legal business profile from Partner Center. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSLegalBusinessProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerLicenseDeploymentInfo.md b/docs/help/Get-PartnerLicenseDeploymentInfo.md new file mode 100644 index 0000000..36f3ec7 --- /dev/null +++ b/docs/help/Get-PartnerLicenseDeploymentInfo.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerLicenseDeploymentInfo + +## SYNOPSIS +Retrieves aggregated data on licenses deployment + +## SYNTAX + +``` +Get-PartnerLicenseDeploymentInfo [] +``` + +## DESCRIPTION +Retrieve aggregated data on licenses deployment for all customers. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerLicenseDeploymentInfo +``` + +Retrieve aggregated data on licenses deployment for all customers. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics.PSPartnerLicensesDeploymentInsight + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerLicenseUsageInfo.md b/docs/help/Get-PartnerLicenseUsageInfo.md new file mode 100644 index 0000000..281aa23 --- /dev/null +++ b/docs/help/Get-PartnerLicenseUsageInfo.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerLicenseUsageInfo + +## SYNOPSIS +Retrieves aggregated data on licenses deployment + +## SYNTAX + +``` +Get-PartnerLicenseUsageInfo [] +``` + +## DESCRIPTION +Retrieves aggregated data on licenses deployment for all customers. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerLicenseUsageInfo +``` + +Retrieves aggregated data on licenses deployment for all customers. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics.PSPartnerLicensesUsageInsight + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerOffer.md b/docs/help/Get-PartnerOffer.md new file mode 100644 index 0000000..7bf0046 --- /dev/null +++ b/docs/help/Get-PartnerOffer.md @@ -0,0 +1,137 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerOffer + +## SYNOPSIS +Gets a specific offer or a list of available offers from Partner Center. + +## SYNTAX + +``` +Get-PartnerOffer [-AddOn] [-Category ] [-CountryCode ] [-OfferId ] [-Trial] + [] +``` + +## DESCRIPTION + +The Get-PartnerOffer cmdlet with retrieve a specific offer or a list of offers by market from Partner Center. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerOffer -Country US +``` + +Gets a list of available offers for the US market. + +### Example 2 +```powershell +PS C:\> Get-PartnerOffer -Country US -Category SmallBusiness_Key +``` + +Gets a list of offers that matches the corresponding category for the US market. + +### Example 3 +```powershell +PS C:\> Get-PartnerOffer -Country US -OfferId '031C9E47-4802-4248-838E-778FB1D2CC05' +``` + +Gets the offer that matches the corresponding identifier for the US market. + +## PARAMETERS + +### -AddOn +Scope returned offers to only add-ons. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Category +Category that corresponds to the offers. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CountryCode +The country ISO2 code. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OfferId +A GUID that corresponds to the offer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Trial +Scope returned offers to only trials. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Offers.PSOffer + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerOfferAddon.md b/docs/help/Get-PartnerOfferAddon.md new file mode 100644 index 0000000..3781fd1 --- /dev/null +++ b/docs/help/Get-PartnerOfferAddon.md @@ -0,0 +1,76 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerOfferAddon + +## SYNOPSIS +Gets the add-ons for an offer by identifier. + +## SYNTAX + +``` +Get-PartnerOfferAddon [-CountryCode ] [-OfferId] [] +``` + +## DESCRIPTION +Gets the add-ons for an offer by country and offer identifier. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerOffAddon -OfferId 031C9E47-4802-4248-838E-778FB1D2CC05 +``` + +Gets the add-ons for the the specified offer. If the country code is not specified it will default to the country code associated with the partner's legal business profile. + +## PARAMETERS + +### -CountryCode +The country code in ISO2 format. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OfferId +A GUID that corresponds to the offer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Offers.PSOffer + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerOrganizationProfile.md b/docs/help/Get-PartnerOrganizationProfile.md new file mode 100644 index 0000000..98ec80f --- /dev/null +++ b/docs/help/Get-PartnerOrganizationProfile.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerOrganizationProfile + +## SYNOPSIS +Gets the partner organization profile from Partner Center. + +## SYNTAX + +``` +Get-PartnerOrganizationProfile [] +``` + +## DESCRIPTION +The Get-PartnerOrganizationProfile cmdlet gets the partner organization profile from Partner Center. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerOrganizationProfile +``` + +Gets the partner organization profile from Partner Center. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSOrganizationProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerProduct.md b/docs/help/Get-PartnerProduct.md new file mode 100644 index 0000000..a538035 --- /dev/null +++ b/docs/help/Get-PartnerProduct.md @@ -0,0 +1,114 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerProduct + +## SYNOPSIS +Gets a list or a single product. + +## SYNTAX + +### ByCatalog (Default) +``` +Get-PartnerProduct [-CountryCode ] -Catalog [-Segment ] [] +``` + +### ByProductId +``` +Get-PartnerProduct [-CountryCode ] -ProductId [] +``` + +## DESCRIPTION +Gets a list or a single product. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerProduct -Catalog 'Azure' -Segment 'commercial' +``` + +Gets a list of products scoped to the Azure target view and commercial segment. + +## PARAMETERS + +### -Catalog +A string that the product catalog. + +```yaml +Type: String +Parameter Sets: ByCatalog +Aliases: +Accepted values: Azure, OnlineServices, Software + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CountryCode +The country ISO2 code. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProductId +A string that identifies the product. + +```yaml +Type: String +Parameter Sets: ByProductId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Segment +A string that the product segment. + +```yaml +Type: String +Parameter Sets: ByCatalog +Aliases: +Accepted values: commercial, education, government, nonprofit + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProduct + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerProductAvailability.md b/docs/help/Get-PartnerProductAvailability.md new file mode 100644 index 0000000..0f9082f --- /dev/null +++ b/docs/help/Get-PartnerProductAvailability.md @@ -0,0 +1,130 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerProductAvailability + +## SYNOPSIS +Gets the availability for a specified product. + +## SYNTAX + +### BySku (Default) +``` +Get-PartnerProductAvailability -ProductId -SkuId [-CountryCode ] [-Segment ] + [] +``` + +### ByAvailabilityId +``` +Get-PartnerProductAvailability -ProductId -SkuId [-CountryCode ] + -AvailabilityId [] +``` + +## DESCRIPTION +Gets the availability for a specified product. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerProductAvailability -Product DZH318Z0BQ3Q -SkuId 0001 +``` + +Gets the availability for a specified product. + +## PARAMETERS + +### -AvailabilityId +A string that identifies the availability. + +```yaml +Type: String +Parameter Sets: ByAvailabilityId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CountryCode +The country ISO2 code. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProductId +A string that identifies the product. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Segment +A string that identifies the product segment. + +```yaml +Type: String +Parameter Sets: BySku +Aliases: +Accepted values: commercial, education, government, nonprofit + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkuId +A string that identifies the product Sku. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProductAvailability + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerProductInventory.md b/docs/help/Get-PartnerProductInventory.md new file mode 100644 index 0000000..01786d2 --- /dev/null +++ b/docs/help/Get-PartnerProductInventory.md @@ -0,0 +1,108 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerProductInventory + +## SYNOPSIS +Checks the inventory for the specified product. + +## SYNTAX + +``` +Get-PartnerProductInventory [-CountryCode ] -ProductId [-SkuId ] + [-Variables ] [] +``` + +## DESCRIPTION +Checks the inventory for the specified product. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> $variables = @{ customerId='46a62ece-10ad-42e5-b3f1-b2ed53e6fc08'; azureSubscriptionId='f5edca90-8799-44bd-ac59-64bd93285ed1'; armRegionName='uswest' } +PS C:\> Get-PartnerProductInventory -ProductId 'DZH318Z0BQ3P' -Variables $variables +``` + +Checks the inventory for the specified product. + +## PARAMETERS + +### -CountryCode +The country ISO2 code. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProductId +A string that identifies the product. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkuId +A string that identifies the sku. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Variables +A hashtable of inventory variables for the product. + +```yaml +Type: Hashtable +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSInventoryItem + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerProductSKU.md b/docs/help/Get-PartnerProductSKU.md new file mode 100644 index 0000000..f8de817 --- /dev/null +++ b/docs/help/Get-PartnerProductSKU.md @@ -0,0 +1,118 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerProductSKU + +## SYNOPSIS +Gets the list of SKUs for a product. + +## SYNTAX + +### ByProductId (Default) +``` +Get-PartnerProductSKU [-CountryCode ] -ProductId [] +``` + +### BySkuId +``` +Get-PartnerProductSKU [-CountryCode ] -ProductId -SkuId [] +``` + +### BySegment +``` +Get-PartnerProductSKU [-CountryCode ] -ProductId [-Segment ] [] +``` + +## DESCRIPTION +Gets the list of SKUs for a specified product. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerProductSku -ProductId 'DZH318Z0BQ5S' +``` + +Gets the available SKUs for the product with the identifier of DZH318Z0BQ5S. + +## PARAMETERS + +### -CountryCode +The country ISO2 code. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProductId +A string that identifies the product. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Segment +A string that the product segment. + +```yaml +Type: String +Parameter Sets: BySegment +Aliases: +Accepted values: commercial, education, government, nonprofit + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkuId +A string that identifies the sku. + +```yaml +Type: String +Parameter Sets: BySkuId +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSSku + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerResellerRequestLink.md b/docs/help/Get-PartnerResellerRequestLink.md new file mode 100644 index 0000000..95db0d7 --- /dev/null +++ b/docs/help/Get-PartnerResellerRequestLink.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerResellerRequestLink + +## SYNOPSIS +Retrieves a relationship request URL to send to a customer. + +## SYNTAX + +``` +Get-PartnerResellerRequestLink [] +``` + +## DESCRIPTION +Retrieves a relationship request URL to send to a customer. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerResellerRequestLink +``` + +Retrieves a relationship request URL to send to a customer. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerRelationshipRequests.PSCustomerRelationshipRequest + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerServiceIncident.md b/docs/help/Get-PartnerServiceIncident.md new file mode 100644 index 0000000..580bb01 --- /dev/null +++ b/docs/help/Get-PartnerServiceIncident.md @@ -0,0 +1,77 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerServiceIncident + +## SYNOPSIS +Gets a list of service incidents. + +## SYNTAX + +``` +Get-PartnerServiceIncident [-Status ] [-Resolved] [] +``` + +## DESCRIPTION +Gets a list of service incidents. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerServiceIncident -Status Warning -Resolved +``` + +Gets a list of service incidents that have a status of warning and are marked as resolved. + +## PARAMETERS + +### -Resolved +If specified resolved incidents are also returned. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Status +Specifies which status types to return. + +```yaml +Type: ServiceIncidentStatus +Parameter Sets: (All) +Aliases: +Accepted values: Critical, Information, Normal, Warning + +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 + +### Microsoft.Store.PartnerCenter.Models.ServiceIncidents.ServiceIncidentDetail + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerServiceRequest.md b/docs/help/Get-PartnerServiceRequest.md new file mode 100644 index 0000000..7ce9316 --- /dev/null +++ b/docs/help/Get-PartnerServiceRequest.md @@ -0,0 +1,128 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerServiceRequest + +## SYNOPSIS +Gets the specified customer's service requests. + +## SYNTAX + +### ByStatus (Default) +``` +Get-PartnerServiceRequest [-Status ] [-Severity ] + [] +``` + +### BySeverity +``` +Get-PartnerServiceRequest [-Status ] [-Severity ] + [] +``` + +### ByCustomerId +``` +Get-PartnerServiceRequest [-Status ] [-Severity ] + -CustomerId [] +``` + +### ByRequestId +``` +Get-PartnerServiceRequest -CustomerId [-RequestId ] [] +``` + +## DESCRIPTION + +Gets the specified customer's service requests. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerServiceRequest -CustomerId -Severity "Critical" -Status "Open" +``` + +Gets the service requests for the specified customer that are critical in severity and have a status of open. + +## PARAMETERS + +### -CustomerId +The identifier of the customer. + +```yaml +Type: String +Parameter Sets: ByCustomerId, ByRequestId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RequestId +The identifier of the service request. + +```yaml +Type: String +Parameter Sets: ByRequestId +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Severity +The status of the support request. + +```yaml +Type: ServiceRequestSeverity +Parameter Sets: ByStatus, BySeverity, ByCustomerId +Aliases: +Accepted values: Critical, Minimal, Moderate, Unknown + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Status +The status of the support request. + +```yaml +Type: ServiceRequestStatus +Parameter Sets: ByStatus, BySeverity, ByCustomerId +Aliases: +Accepted values: AttentionNeeded, Closed, None, Open + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.ServiceRequests.PSServiceRequest + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerServiceRequestTopic.md b/docs/help/Get-PartnerServiceRequestTopic.md new file mode 100644 index 0000000..a4f6d4c --- /dev/null +++ b/docs/help/Get-PartnerServiceRequestTopic.md @@ -0,0 +1,68 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerServiceRequestTopic + +## SYNOPSIS +Gets a list of service request topics. + +## SYNTAX + +``` +Get-PartnerServiceRequestTopic [-SupportTopicId ] [] +``` + +## DESCRIPTION +Gets a collection of items representing valid topics for service requests. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerServiceRequestTopic -SupportTopicId +``` + +Gets a specific support topic based on the specified support topic identifier. + +### Example 2 +```powershell +PS C:\> Get-PartnerServiceRequestTopic +``` + +Gets all of the available support topics. + +## PARAMETERS + +### -SupportTopicId +The identifier of the support topic. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.ServiceRequests.PSSupportTopic + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Get-PartnerSupportProfile.md b/docs/help/Get-PartnerSupportProfile.md new file mode 100644 index 0000000..1dbffdd --- /dev/null +++ b/docs/help/Get-PartnerSupportProfile.md @@ -0,0 +1,46 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Get-PartnerSupportProfile + +## SYNOPSIS +Gets the partner's support profile. + +## SYNTAX + +``` +Get-PartnerSupportProfile [] +``` + +## DESCRIPTION +Gets the partner's support profile. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-PartnerSupportProfile +``` + +Gets the partner's support profile. + +## PARAMETERS + +### 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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSSupportProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomer.md b/docs/help/New-PartnerCustomer.md new file mode 100644 index 0000000..9b7f666 --- /dev/null +++ b/docs/help/New-PartnerCustomer.md @@ -0,0 +1,307 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomer + +## SYNOPSIS +Creates a new customer. + +## SYNTAX + +``` +New-PartnerCustomer -BillingAddressLine1 [-BillingAddressLine2 ] + [-BillingAddressCity ] -BillingAddressCountry [-BillingAddressPostalCode ] + [-BillingAddressRegion ] [-BillingAddressState ] [-ContactEmail ] + [-ContactFirstName ] [-ContactLastName ] [-ContactPhoneNumber ] [-Culture ] + -Domain -Language -Name [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Creates a new customer. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> New-PartnerCustomer -BillingAddressLine1 '1 Microsoft Way' -BillingAddressCity 'Redmond' -BillingAddressCountry ;'US' -BillingAddressPostalCode '98052' -BillingAddressState 'WA' -ContactEmail 'jdoe@customer.com' -ContactFirstName 'Jane' -ContactLastName 'Doe' -Culture 'en-US' -Domain 'newcustomer.onmicrosoft.com' -Language 'en' -Name 'New Customer' +``` + +Creates a new customer. + +## PARAMETERS + +### -BillingAddressCity +The city of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressCountry +The country of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressLine1 +The first line of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressLine2 +The second line of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressPostalCode +The postal code of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressRegion +The region of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressState +The state of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactEmail +The email address of the primary contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactFirstName +The first name of the primary contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactLastName +The last name of the primary contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactPhoneNumber +The phone number of the primary contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Culture +The preferred culture for communication and currency. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Domain +The customer's domain name, such as contoso.onmicrosoft.com. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Language +The default language. +Two character language codes (e.g., en, fr) are supported. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the customer to be created. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerAgreement.md b/docs/help/New-PartnerCustomerAgreement.md new file mode 100644 index 0000000..95a9fff --- /dev/null +++ b/docs/help/New-PartnerCustomerAgreement.md @@ -0,0 +1,154 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerAgreement + +## SYNOPSIS +Confirms the customer acceptance of the Microsoft Cloud agreement. + +## SYNTAX + +``` +New-PartnerCustomerAgreement -AgreementType -ContactEmail -ContactFirstName + -ContactLastName [-ContactPhoneNumber ] -CustomerId -TemplateId + [] +``` + +## DESCRIPTION +Confirms the customer acceptance of the Microsoft Cloud agreement. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> New-PartnerCustomerAgreement -AgreementType MicrosoftCloudAgreement -ContactEmail 'jdoe@customer.com' -ContactFirstName 'Jane' -ContactLastName 'Doe' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -TemplateId '998b88de-aa99-4388-a42c-1b3517d49490' +``` + +Confirms the customer acceptance of the Microsoft Cloud agreement. + +## PARAMETERS + +### -AgreementType +The type of agreement being accepted. + +```yaml +Type: AgreementType +Parameter Sets: (All) +Aliases: +Accepted values: MicrosoftCloudAgreement + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactEmail +The email address of the contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactFirstName +The first name of the contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactLastName +The last name of the contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContactPhoneNumber +The phone number of the contact at the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TemplateId +The identifier for the template. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Agreements.PSAgreement + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerCart.md b/docs/help/New-PartnerCustomerCart.md new file mode 100644 index 0000000..cd936fb --- /dev/null +++ b/docs/help/New-PartnerCustomerCart.md @@ -0,0 +1,110 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerCart + +## SYNOPSIS +Creates an order for a customer. + +## SYNTAX + +``` +New-PartnerCustomerCart -CustomerId -LineItems [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Creates an order for a customer. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> $lineItems = @() +PS C:\> $lineItems += New-PartnerCustomerCartLineItem -BillingCycle 'OneTime' -CatalogItemId 'DG7GMGF0DWTL:0001:DG7GMGF0DSJB' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -FriendlyName 'Sample RI Purchase' -ProvisioningContext @{duration='1Year'; scope='shared'; subscriptionId='b35d5324-df8e-4306-9023-6edac2d4896c'} -Quantity 10 +PS C:\> New-PartnerCustomerCart -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -LineItems $lineItems +``` + +Creates an order for a customer. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LineItems +A list of cart line items. + +```yaml +Type: CartLineItem[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Carts.PSCart + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerCartLineItem.md b/docs/help/New-PartnerCustomerCartLineItem.md new file mode 100644 index 0000000..c72b648 --- /dev/null +++ b/docs/help/New-PartnerCustomerCartLineItem.md @@ -0,0 +1,200 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerCartLineItem + +## SYNOPSIS +Creates a new cart line item object in memory. + +## SYNTAX + +``` +New-PartnerCustomerCartLineItem -BillingCycle -CatalogItemId -CustomerId + [-CurrencyCode ] [-FriendlyName ] [-OrderGroup ] [-ProvisioningContext ] + [-Quantity ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Creates a new cart line item object in memory. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> New-PartnerCustomerCartLineItem -BillingCycle 'OneTime' -CatalogItemId 'DG7GMGF0DWTL:0001:DG7GMGF0DSJB' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -FriendlyName 'Sample RI Purchase' -ProvisioningContext ${duration='1Year', scope='shared', subscriptionId='b35d5324-df8e-4306-9023-6edac2d4896c'} -Quantity 10 +``` + +Creates a new cart line item object in memory. + +## PARAMETERS + +### -BillingCycle +The type of billing cycle set for the current period. + +```yaml +Type: BillingCycleType +Parameter Sets: (All) +Aliases: +Accepted values: Annual, Monthly, None, OneTime + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CatalogItemId +The catalog item identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CurrencyCode +The currency code used when this line item is invoiced. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FriendlyName +The friendly name for the item defined by the partner to help disambiguate. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrderGroup +A group to indicate which items can be placed together. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisioningContext +A context used for provisioning of offer. + +```yaml +Type: Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Quantity +The number of licenses or instances. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Carts.PSCartLineItem + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerConfigurationPolicy.md b/docs/help/New-PartnerCustomerConfigurationPolicy.md new file mode 100644 index 0000000..ec350da --- /dev/null +++ b/docs/help/New-PartnerCustomerConfigurationPolicy.md @@ -0,0 +1,214 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerConfigurationPolicy + +## SYNOPSIS + +Creates a new configuration policy for the specified customer. + +## SYNTAX + +``` +New-PartnerCustomerConfigurationPolicy [-CustomerId] [-Name] [-Description ] + [-RemoveOemPreinstalls ] [-OobeUserNotLocalAdmin ] [-SkipExpressSettings ] + [-SkipEula ] [-SkipOemRegistration ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +The New-PartnerCustomerConfigurationPolicy cmdlet creates a new configuration policy. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> New-PartnerCustomerConfigurationPolicy -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -Name "New Config Policy" -Description "Test Policy" -SkipEula $true -OobeUserNotLocalAdmin $true +``` + +Create a new configuration policy for a customer with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08. The policy is named "New Config Policy" and has a description of "Test Policy. Both the SkipEula and OobeUserNotLocalAdmin policies have been set. + +## PARAMETERS + +### -CustomerId + +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description + +Description for the new policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name + +Policy name for the new policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OobeUserNotLocalAdmin + +Enables or disables the Disable local admin account in setup policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoveOemPreinstalls +Enables or disables the Remove OEM preinstalls policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipEula + +Enables or disables the Skip end user license agreement (EULA) policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipExpressSettings + +Enables or disables the Automatically skip pages in setup policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipOemRegistration +Enables or disables the Skip OEM registration policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.PSConfigurationPolicy + + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerOrder.md b/docs/help/New-PartnerCustomerOrder.md new file mode 100644 index 0000000..0f244a3 --- /dev/null +++ b/docs/help/New-PartnerCustomerOrder.md @@ -0,0 +1,111 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerOrder + +## SYNOPSIS +Create a new order for the specified services on behalf of the customer. + +## SYNTAX + +``` +New-PartnerCustomerOrder -CustomerId -LineItems [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Create a new order for the specified services on behalf of the customer. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> $lineItem = New-PartnerCustomerOrderLineItem -LineItemNumber 0 -OfferId 031C9E47-4802-4248-838E-778FB1D2CC05 -Quantity 1 +PS C:\> New-PartnerCustomerOrder -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -LineItems @($lineItem) +``` + +Create a new order for the specified services on behalf of the customer. + +## PARAMETERS + +### -CustomerId +The identifier of the customer making the purchase. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LineItems +The order line items. +Each order line item refers to one offer's purchase data. + +```yaml +Type: PSOrderLineItem[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Orders.PSOrder + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerOrderLineItem.md b/docs/help/New-PartnerCustomerOrderLineItem.md new file mode 100644 index 0000000..a6ca558 --- /dev/null +++ b/docs/help/New-PartnerCustomerOrderLineItem.md @@ -0,0 +1,200 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerOrderLineItem + +## SYNOPSIS +Creates a new order line item in memory. + +## SYNTAX + +``` +New-PartnerCustomerOrderLineItem [-FriendlyName ] -LineItemNumber -OfferId + [-PartnerIdOnRecord ] [-ParentSubscriptionId ] [-ProvisioningContext ] + -Quantity [-SubscriptionId ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +Creates a new order line item in memory. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> New-PartnerCustomerOrderLineItem -LineItemNumber 0 -OfferId 031C9E47-4802-4248-838E-778FB1D2CC05 -Quantity 1 +``` + +Creates a new order line item in memory that will be used to order the offer with the identifier of 031C9E47-4802-4248-838E-778FB1D2CC05. + +## PARAMETERS + +### -FriendlyName +The friendly name for the result contract (subscription). + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LineItemNumber +The line item number. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OfferId +The offer identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ParentSubscriptionId +The parent subscription identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PartnerIdOnRecord +The partner identifier on record. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisioningContext +The provisioning context for the offer. + +```yaml +Type: Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Quantity +The product quantity. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The resulting subscription identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Orders.PSOrderLineItem + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerSubscriptionRegistration.md b/docs/help/New-PartnerCustomerSubscriptionRegistration.md new file mode 100644 index 0000000..d0fa85d --- /dev/null +++ b/docs/help/New-PartnerCustomerSubscriptionRegistration.md @@ -0,0 +1,108 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerSubscriptionRegistration + +## SYNOPSIS +Registers the specified subscription. + +## SYNTAX + +``` +New-PartnerCustomerSubscriptionRegistration -CustomerId -SubscriptionId [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Registers the specified subscription, so that is eligible to purcahse Azure reservations. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> New-PartnerCustomerSubscriptionRegistration -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -SubscriptionId 'b2f26801-2849-4fb1-8815-ad5fcd81143d' +``` + +Registers the specified subscription. + +## PARAMETERS + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The identifier for the subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### System.String + +## NOTES + +## RELATED LINKS diff --git a/docs/help/New-PartnerCustomerUser.md b/docs/help/New-PartnerCustomerUser.md new file mode 100644 index 0000000..1a9557c --- /dev/null +++ b/docs/help/New-PartnerCustomerUser.md @@ -0,0 +1,200 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# New-PartnerCustomerUser + +## SYNOPSIS +Creates a new user in the specified customer Azure Active Directory tenant. + +## SYNTAX + +``` +New-PartnerCustomerUser -CustomerId [-FirstName ] [-LastName ] -DisplayName + -UserPrincipalName -Password [-ForceChangePassword] [-UsageLocation ] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION + +The New-PartnerCustomerUser cmdlet creates a new user in the tenant Azure Active Directory. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> New-PartnerCustomerUser -CustomerId 45916f92-e9c3-4ed2-b8c2-d87aa129905f -UsageLocation US -UserPrincipalName 'joe@contoso.onmicrosoft.com' -FirstName 'Joe' -LastName 'Smith' -DisplayName 'Joe Smith' -ForceChangePassword -Password $PasswordSecure +``` + +Creates a new user account. + +## PARAMETERS + +### -CustomerId +The customer identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DisplayName +The display name for the new customer user. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirstName +The first name for the new customer user. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ForceChangePassword +Forces user to change password during next login. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastName +The last name for the new customer user. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +The password for the new custom user as a secure string + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UsageLocation +The location where the customer user will use software and services. Service availability varies by region. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserPrincipalName +The user principal name (UPN) for the new customer user, including the onmicrosoft.com domain name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + +## NOTES + +## RELATED LINKS diff --git a/docs/help/PartnerCenter.md b/docs/help/PartnerCenter.md new file mode 100644 index 0000000..f8ce894 --- /dev/null +++ b/docs/help/PartnerCenter.md @@ -0,0 +1,213 @@ +--- +Module Name: PartnerCenter +Module Guid: 70cb9a9e-1491-403a-8a2f-63e1afe7dfee +Download Help Link: none +Help Version: 1.0 +Locale: en-US +--- + +# PartnerCenter Module +## Description +This topic displays help topics for the Partner Center Cmdlets. + +## PartnerCenter Cmdlets +### [Add-PartnerCustomerCartLineItem](Add-PartnerCustomerCartLineItem.md) +Adds a new line item to the specified cart. + +### [Add-PartnerCustomerUserRoleMember](Add-PartnerCustomerUserRoleMember.md) +Adds a customer user to a specified role. + +### [Connect-PartnerCenter](Connect-PartnerCenter.md) +Connect to Partner Center with an authenticated account for use with cmdlet requests. + +### [Get-PartnerAgreementDetail](Get-PartnerAgreementDetail.md) +Gets the agreement metadata for the Microsoft Cloud Agreement. + +### [Get-PartnerAuditRecord](Get-PartnerAuditRecord.md) +Retrieves audit records from Partner Center. + +### [Get-PartnerAzureRateCard](Get-PartnerAzureRateCard.md) +Gets real-time prices for an Azure offer. + +### [Get-PartnerBillingProfile](Get-PartnerBillingProfile.md) +Gets the partner's billing profile. + +### [Get-PartnerCountryValidation](Get-PartnerCountryValidation.md) +Gets the rules for validating an address for a specific country. + +### [Get-PartnerCustomer](Get-PartnerCustomer.md) +Gets a specific customer or a list of available customers. + +### [Get-PartnerCustomerAgreement](Get-PartnerCustomerAgreement.md) +Retrieves confirmation of customer acceptance provided previously. + +### [Get-PartnerCustomerCart](Get-PartnerCustomerCart.md) +Gets a specific cart for the specified partner. + +### [Get-PartnerCustomerConfigurationPolicy](Get-PartnerCustomerConfigurationPolicy.md) +Gets a list of all of a customer's policies. + +### [Get-PartnerCustomerDevice](Get-PartnerCustomerDevice.md) +Gets a list of devices in the specified device batch for the specified customer. + +### [Get-PartnerCustomerDeviceBatch](Get-PartnerCustomerDeviceBatch.md) +Gets a list of device batches for the specified customer Id. + +### [Get-PartnerCustomerEntitlement](Get-PartnerCustomerEntitlement.md) +Gets a collection of entitlements. + +### [Get-PartnerCustomerLicense](Get-PartnerCustomerLicense.md) +Get a list of licenses available for a customer that are assigned or can be assigned to a user. + +### [Get-PartnerCustomerLicenseDeploymentInfo](Get-PartnerCustomerLicenseDeploymentInfo.md) +Gets aggregated data on deployment for a specified customer. + +### [Get-PartnerCustomerManagedService](Get-PartnerCustomerManagedService.md) +Gets the managed services for a customer. + +### [Get-PartnerCustomerOrder](Get-PartnerCustomerOrder.md) +Gets either a specific order or a list of order for the specified customer. + +### [Get-PartnerCustomerSubscription](Get-PartnerCustomerSubscription.md) +Gets a list or a single customer subscription. + +### [Get-PartnerCustomerSubscriptionProvisioningStatus](Get-PartnerCustomerSubscriptionProvisioningStatus.md) +Gets the provisioning status of the specified customerID and subscription ID. + +### [Get-PartnerCustomerSubscriptionRegistrationStatus](Get-PartnerCustomerSubscriptionRegistrationStatus.md) +Gets the subscription registration status. + +### [Get-PartnerCustomerSubscriptionUpgrades](Get-PartnerCustomerSubscriptionUpgrades.md) +Gets the available upgrade offers for the specified subscription. + +### [Get-PartnerCustomerSubscriptionUtilization](Get-PartnerCustomerSubscriptionUtilization.md) +Gets the utilization of a customer's Azure subscription. + +### [Get-PartnerCustomerTrialConversion](Get-PartnerCustomerTrialConversion.md) +Gets a list of trial conversions available for the specified subscription. + +### [Get-PartnerCustomerUser](Get-PartnerCustomerUser.md) +Gets a list of all customer users or a specified user for the tenant. + +### [Get-PartnerCustomerUserRole](Get-PartnerCustomerUserRole.md) +Gets a list of directory roles for a customer. + +### [Get-PartnerIndirectReseller](Get-PartnerIndirectReseller.md) +Gets a list of indirect resellers. + +### [Get-PartnerInvoice](Get-PartnerInvoice.md) +Gets a list of invoices available to the partner. + +### [Get-PartnerInvoiceStatement](Get-PartnerInvoiceStatement.md) +Gets an invoice statement using the invoice identifier. + +### [Get-PartnerInvoiceSummary](Get-PartnerInvoiceSummary.md) +Gets a summary view of the invoice. + +### [Get-PartnerLegalProfile](Get-PartnerLegalProfile.md) +Gets the partner legal business profile from Partner Center. + +### [Get-PartnerLicenseDeploymentInfo](Get-PartnerLicenseDeploymentInfo.md) +Gets aggregated data on licenses deployment + +### [Get-PartnerLicenseUsageInfo](Get-PartnerLicenseUsageInfo.md) +Gets aggregated data on licenses deployment + +### [Get-PartnerOffer](Get-PartnerOffer.md) +Gets a specific offer or a list of available offers from Partner Center. + +### [Get-PartnerOfferAddon](Get-PartnerOfferAddon.md) +Gets the add-ons for an offer by identifier. + +### [Get-PartnerOrganizationProfile](Get-PartnerOrganizationProfile.md) +Gets the partner organization profile from Partner Center. + +### [Get-PartnerProduct](Get-PartnerProduct.md) +Gets a list or a single product. + +### [Get-PartnerProductAvailability](Get-PartnerProductAvailability.md) +Gets the availability for a specified product. + +### [Get-PartnerProductInventory](Get-PartnerProductInventory.md) +Checks the inventory for the specified product. + +### [Get-PartnerProductSKU](Get-PartnerProductSKU.md) +Gets the list of SKUs for a product. + +### [Get-PartnerResellerRequestLink](Get-PartnerResellerRequestLink.md) +Gets a relationship request URL to send to a customer. + +### [Get-PartnerServiceIncident](Get-PartnerServiceIncident.md) +Gets a list of service incidents. + +### [Get-PartnerServiceRequest](Get-PartnerServiceRequest.md) +Gets the specified customer's service requests. + +### [Get-PartnerServiceRequestTopic](Get-PartnerServiceRequestTopic.md) +Gets a list of service request topics. + +### [Get-PartnerSupportProfile](Get-PartnerSupportProfile.md) +Gets the partner's support profile. + +### [Invoke-PartnerCustomerCart](Invoke-PartnerCustomerCart.md) +Checks out the specified cart. + +### [New-PartnerCustomer](New-PartnerCustomer.md) +Creates a new customer. + +### [New-PartnerCustomerAgreement](New-PartnerCustomerAgreement.md) +Confirms the customer acceptance of the Microsoft Cloud agreement. + +### [New-PartnerCustomerCart](New-PartnerCustomerCart.md) +Creates an order for a customer. + +### [New-PartnerCustomerCartLineItem](New-PartnerCustomerCartLineItem.md) +Creates a new cart line item object in memory. + +### [New-PartnerCustomerOrder](New-PartnerCustomerOrder.md) +Create a new order for the specified services on behalf of the customer. + +### [New-PartnerCustomerOrderLineItem](New-PartnerCustomerOrderLineItem.md) +Creates a new order line item in memory. + +### [New-PartnerCustomerSubscriptionRegistration](New-PartnerCustomerSubscriptionRegistration.md) +Registers the specified subscription. + +### [New-PartnerCustomerUser](New-PartnerCustomerUser.md) +Creates a new user in the specified customer Azure Active Directory tenant. + +### [Remove-PartnerCustomerUser](Remove-PartnerCustomerUser.md) +Removes a user from the customer's tenant. + +### [Remove-PartnerCustomerUserRoleMember](Remove-PartnerCustomerUserRoleMember.md) +Removes a customer user from a specified role. + +### [Restore-PartnerCustomerUser](Restore-PartnerCustomerUser.md) +Restores a previously removed customer user from the customer's tenant. + +### [Set-PartnerBillingProfile](Set-PartnerBillingProfile.md) +Updates the partner's billing profile. + +### [Set-PartnerCustomer](Set-PartnerCustomer.md) +Updates a customer's billing profile, including the address associated with the profile. + +### [Set-PartnerCustomerSubscription](Set-PartnerCustomerSubscription.md) +Updates the specified customer subscription. + +### [Set-PartnerCustomerUser](Set-PartnerCustomerUser.md) +Updates the specified customer user account. + +### [Set-PartnerLegalProfile](Set-PartnerLegalProfile.md) +Updates the partner's legal profile. + +### [Set-PartnerOrganizationProfile](Set-PartnerOrganizationProfile.md) +Updates the partner's organization profile + +### [Set-PartnerSupportProfile](Set-PartnerSupportProfile.md) +Updates the partner's support profile. + +### [Test-PartnerAddress](Test-PartnerAddress.md) +Tests whether or not the specified address is valid. + +### [Test-PartnerDomainAvailability](Test-PartnerDomainAvailability.md) +Tests if the specified domain name is available for creating a new tenant \ No newline at end of file diff --git a/docs/help/Remove-PartnerCustomerConfigurationPolicy.md b/docs/help/Remove-PartnerCustomerConfigurationPolicy.md new file mode 100644 index 0000000..eb59869 --- /dev/null +++ b/docs/help/Remove-PartnerCustomerConfigurationPolicy.md @@ -0,0 +1,83 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Remove-PartnerCustomerConfigurationPolicy + +## SYNOPSIS + +Removes the specified configuration policy. + +## SYNTAX + +``` +Remove-PartnerCustomerConfigurationPolicy [-CustomerId] -PolicyId [] +``` + +## DESCRIPTION + +The Remove-PartnerCustomerConfigurationPolicy removes the specified configuration policy. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Remove-PartnerCustomerConfigurationPolicy -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -PolicyId 2975afbf-4859-4d56-9f8d-e86996db92dd +``` + +Remove the configuration policy with the identifier of 2975afbf-4859-4d56-9f8d-e86996db92dd from the customer with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08. + +## PARAMETERS + +### -CustomerId + +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyId + +The identifier for the configuration policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Remove-PartnerCustomerUser.md b/docs/help/Remove-PartnerCustomerUser.md new file mode 100644 index 0000000..f0df0e4 --- /dev/null +++ b/docs/help/Remove-PartnerCustomerUser.md @@ -0,0 +1,136 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Remove-PartnerCustomerUser + +## SYNOPSIS +Removes a user from the customer's tenant. + +## SYNTAX + +### ByUserId (Default) +``` +Remove-PartnerCustomerUser [-CustomerId] -UserId [-WhatIf] [-Confirm] [] +``` + +### ByUpn +``` +Remove-PartnerCustomerUser [-CustomerId] -UserPrincipalName [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +The Remove-PartnerCustomerUser cmdlet removes the specified user from the customer tenant. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Remove-PartnerCustomerUser -CustomerId db8ea5b4-a69b-45f3-abd3-dca19e87c536 -UserPrincipalName "hugh@wingtiptoys.onmicrosoft.com" +``` + +Removes the customer user with the User Principal Name of Hugh@wingtiptoys.onmicrosoft.com + +### Example 2 +```powershell +PS C:\> Remove-PartnerCustomerUser -CustomerId db8ea5b4-a69b-45f3-abd3-dca19e87c536 -UserId +``` + +Removes the customer user with the User identifier of 6e668259-1f09-479d-bcb8-d9b03e826b8d + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +Identifier for the user. + +```yaml +Type: String +Parameter Sets: ByUserId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserPrincipalName +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: ByUpn +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Remove-PartnerCustomerUserRoleMember.md b/docs/help/Remove-PartnerCustomerUserRoleMember.md new file mode 100644 index 0000000..09bdea0 --- /dev/null +++ b/docs/help/Remove-PartnerCustomerUserRoleMember.md @@ -0,0 +1,92 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Remove-PartnerCustomerUserRoleMember + +## SYNOPSIS +Removes a customer user from a specified role. + +## SYNTAX + +``` +Remove-PartnerCustomerUserRoleMember -CustomerId [-UserId ] [-RoleId ] + [] +``` + +## DESCRIPTION +The Remove-PartnerCustomerUserRoleMember cmdlets removes a specified role to the target customer user. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Remove-PartnerCustomerUserRoleMember -CustomerId c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2 -UserId 17765f05-723c-4be4-89e2-c7d1cdbb0906 -RoleId 62e90394-69f5-4237-9190-012177145e10 +``` + +Removes the specified user with the identifier of 17765f05-723c-4be4-89e2-c7d1cdbb0906 from the role with the identifier of 62e90394-69f5-4237-9190-012177145e10. + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RoleId +Identifier for the role. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +Identifier for the user. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Remove-PartnerSandboxCustomer.md b/docs/help/Remove-PartnerSandboxCustomer.md new file mode 100644 index 0000000..0ce081d --- /dev/null +++ b/docs/help/Remove-PartnerSandboxCustomer.md @@ -0,0 +1,93 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Remove-PartnerSandboxCustomer + +## SYNOPSIS +Removes the specified customer. + +## SYNTAX + +``` +Remove-PartnerSandboxCustomer [-CustomerId] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Removes the specified customer. This operation is only supported when connected to the integration sandbox. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Remove-PartnerSandboxCustomer '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Removes the specified customer. + +## PARAMETERS + +### -CustomerId +The identifier of the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Restore-PartnerCustomerUser.md b/docs/help/Restore-PartnerCustomerUser.md new file mode 100644 index 0000000..5d1fc17 --- /dev/null +++ b/docs/help/Restore-PartnerCustomerUser.md @@ -0,0 +1,136 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Restore-PartnerCustomerUser + +## SYNOPSIS +Restores a previously removed customer user from the customer's tenant. + +## SYNTAX + +### ByUserId (Default) +``` +Restore-PartnerCustomerUser [-CustomerId] -UserId [-WhatIf] [-Confirm] [] +``` + +### ByUpn +``` +Restore-PartnerCustomerUser [-CustomerId] -UserPrincipalName [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +The Restore-PartnerCustomerUser cmdlet restores the specified user that was previously removed from the customer tenant. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Restore-PartnerCustomerUser -CustomerId db8ea5b4-a69b-45f3-abd3-dca19e87c536 -UserPrincipalName "Hugh@wingtiptoys.onmicrosoft.com" +``` + +Restores the customer user with the User Principal Name of Hugh@wingtiptoys.onmicrosoft.com + +### Example 2 +```powershell +PS C:\> Remove-PartnerCustomerUser -CustomerId db8ea5b4-a69b-45f3-abd3-dca19e87c536 -UserId +``` + +Restores the customer user with the User identifier of 6e668259-1f09-479d-bcb8-d9b03e826b8d + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +Identifier for the user. + +```yaml +Type: String +Parameter Sets: ByUserId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserPrincipalName +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: ByUpn +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerBillingProfile.md b/docs/help/Set-PartnerBillingProfile.md new file mode 100644 index 0000000..3975939 --- /dev/null +++ b/docs/help/Set-PartnerBillingProfile.md @@ -0,0 +1,262 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerBillingProfile + +## SYNOPSIS +Updates the partner's billing profile. + +## SYNTAX + +``` +Set-PartnerBillingProfile [-AddressLine1 ] [-AddressLine2 ] [-City ] + [-EmailAddress ] [-FirstName ] [-LastName ] [-PhoneNumber ] + [-PostalCode ] [-PurchaseOrderNumber ] [-Region ] [-State ] [-TaxId ] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates the partner's billing profile. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-PartnerBillingProfile -AddressLine1 "1 Microsoft Way" -AddressLine2 "Suite 55" -City "Redmond" -State "WA" -PostalCode "98052" +``` + +This usage is an example of a partner updating their corporate address. + +## PARAMETERS + +### -AddressLine1 +The first line of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AddressLine2 +The second line of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -City +The city portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EmailAddress +The email address of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirstName +The first name of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastName +The last name of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PhoneNumber +The phone number of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PostalCode +The postal code portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PurchaseOrderNumber +The purchase order number to be used for billing purposes. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Region +The region portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +The state portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TaxId +The tax identifier to be used for billing purposes. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSBillingProfile + +## NOTES + +## RELATED LINKS + +Partner Center SDK reference for updating the partner billing profile: diff --git a/docs/help/Set-PartnerCustomer.md b/docs/help/Set-PartnerCustomer.md new file mode 100644 index 0000000..5a5edfc --- /dev/null +++ b/docs/help/Set-PartnerCustomer.md @@ -0,0 +1,247 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerCustomer + +## SYNOPSIS +Updates a customer's billing profile, including the address associated with the profile. + +## SYNTAX + +### Customer (Default) +``` +Set-PartnerCustomer [-BillingAddressLine1 ] [-BillingAddressLine2 ] + [-BillingAddressCity ] [-BillingAddressCountry ] [-BillingAddressPostalCode ] + [-BillingAddressRegion ] [-BillingAddressState ] -CustomerId [-Name ] + [-WhatIf] [-Confirm] [] +``` + +### CustomerObject +``` +Set-PartnerCustomer -InputObject [-BillingAddressLine1 ] [-BillingAddressLine2 ] + [-BillingAddressCity ] [-BillingAddressCountry ] [-BillingAddressPostalCode ] + [-BillingAddressRegion ] [-BillingAddressState ] [-Name ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Updates a customer's billing profile. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-PartnerCustomer -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -BillingAddressLine1 '700 Bellevue Way' -BillingAddressCity 'Bellevue' -BillingAddressPostalCode '98004' +``` + +Updates the billing address for the customer, with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08, to 700 Bellevue Way NE, Bellevue, WA 98004. + +### Example 2 +```powershell +PS C:\> $customer = Get-PartnerCustomer 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 +PS C:\> $customer | Set-PartnerCustomer -BillingAddressLine1 '700 Bellevue Way' -BillingAddressCity 'Bellevue' -BillingAddressPostalCode '98004' +``` + +Updates the billing address for the customer, with the identifier of 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08, to 700 Bellevue Way NE, Bellevue, WA 98004. + +## PARAMETERS + +### -BillingAddressCity +The city of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressCountry +The country of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressLine1 +The first line of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressLine2 +The second line of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressPostalCode +The postal code of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressRegion +The region of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BillingAddressState +The state of the customer's billing address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +Identifier of the customer being modified. + +```yaml +Type: String +Parameter Sets: Customer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The customer object to be modified. + +```yaml +Type: PSCustomer +Parameter Sets: CustomerObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + +## OUTPUTS + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerCustomerConfigurationPolicy.md b/docs/help/Set-PartnerCustomerConfigurationPolicy.md new file mode 100644 index 0000000..bae033a --- /dev/null +++ b/docs/help/Set-PartnerCustomerConfigurationPolicy.md @@ -0,0 +1,226 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerCustomerConfigurationPolicy + +## SYNOPSIS + +Updates an existing configuration policy with the specified options. + +## SYNTAX + +``` +Set-PartnerCustomerConfigurationPolicy [-CustomerId] -PolicyId [-Name ] + [-Description ] [-RemoveOemPreinstalls ] [-OobeUserNotLocalAdmin ] + [-SkipExpressSettings ] [-SkipEula ] [-SkipOemRegistration ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION + +The Set-PartnerCustomerConfigurationPolicy cmdlet will update an existing configuration. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Set-PartnerCustomerConfigurationPolicy -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -PolicyId 2975afbf-4859-4d56-9f8d-e86996db92dd -Name "Updated Policy Name" +``` + +Updates the existing configuration policy with the identifier of 2975afbf-4859-4d56-9f8d-e86996db92dd with a new name of "Updated Policy Name" + +## PARAMETERS + +### -CustomerId + +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description + +Description for the policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name + +Policy name for the policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OobeUserNotLocalAdmin + +Enables or disables the Disable local admin account in setup policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PolicyId + +Identifier for the policy. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoveOemPreinstalls +Enables or disables the Remove OEM preinstalls policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipEula +Enables or disables the Skip end user license agreement (EULA) policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipExpressSettings +Enables or disables the Automatically skip pages in setup policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipOemRegistration +Enables or disables the Skip OEM registration policy. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.PSConfigurationPolicy + + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerCustomerSubscription.md b/docs/help/Set-PartnerCustomerSubscription.md new file mode 100644 index 0000000..92a60ed --- /dev/null +++ b/docs/help/Set-PartnerCustomerSubscription.md @@ -0,0 +1,193 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerCustomerSubscription + +## SYNOPSIS +Updates the specified customer subscription. + +## SYNTAX + +### Customer +``` +Set-PartnerCustomerSubscription [-AutoRenew ] -CustomerId [-FriendlyName ] + [-Quantity ] [-Status ] -SubscriptionId [-WhatIf] [-Confirm] + [] +``` + +### CustomerObject +``` +Set-PartnerCustomerSubscription [-AutoRenew ] -InputObject [-FriendlyName ] + [-Quantity ] [-Status ] -SubscriptionId [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Updates the specified customer subscription. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-ParnterCustomerSubscription -AutoRenew $false -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -Subscription dace42ca-22df-4b1f-8f9e-992364dd866e +``` + +Disables the auto renew functionality for the specified subscription. + +## PARAMETERS + +### -AutoRenew +A flag indiciating whether or not the subscription will auto renew. + +```yaml +Type: Boolean +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +The customer identifier used to scope the request. + +```yaml +Type: String +Parameter Sets: Customer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FriendlyName +The friendly name of the subscription. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The customer object used to scope the request. + +```yaml +Type: PSCustomer +Parameter Sets: CustomerObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Quantity +The quantity of the subscription. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Status +The status of the subscription. + +```yaml +Type: SubscriptionStatus +Parameter Sets: (All) +Aliases: +Accepted values: None, Active, Suspended, Deleted + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription identifier used to scope the request. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions.PSSubscription + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerCustomerUser.md b/docs/help/Set-PartnerCustomerUser.md new file mode 100644 index 0000000..849b337 --- /dev/null +++ b/docs/help/Set-PartnerCustomerUser.md @@ -0,0 +1,233 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerCustomerUser + +## SYNOPSIS +Updates the specified customer user account. + +## SYNTAX + +### UserId (Default) +``` +Set-PartnerCustomerUser [-CustomerId] -UserId [-UserPrincipalName ] + [-FirstName ] [-LastName ] [-DisplayName ] [-Password ] + [-ForceChangePasswordNextLogin] [-WhatIf] [-Confirm] [] +``` + +### UserObject +``` +Set-PartnerCustomerUser -InputObject [-CustomerId] [-UserPrincipalName ] + [-FirstName ] [-LastName ] [-DisplayName ] [-Password ] + [-ForceChangePasswordNextLogin] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +The Set-PartnerCustomerUser cmdlet modifies a customer user account. + +## EXAMPLES + +### Example 1 + +```powershell +PS C:\> Set-PartnerCustomerUser -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -UserId a9ef48bb-8758-4590-a312-d4a47bfaded4 -LastName 'Sullivan' +``` + +Modify the user's last name + +### Example 2 + +```powershell +$password = '' +PS C:\>$passwordSecure = $password | ConvertTo-SecureString -AsPlainText -Force +PS C:\>Set-PartnerCustomerUser -CustomerId 46a62ece-10ad-42e5-b3f1-b2ed53e6fc08 -UserId a9ef48bb-8758-4590-a312-d4a47bfaded4 -Password $passwordSecure -ForceChangePassword $true +``` + +Set the password for the user account and require the user to change the password during the next sign on. + +## PARAMETERS + +### -CustomerId +Identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DisplayName +User's display name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirstName +User's first name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ForceChangePasswordNextLogin +Forces user to change password during next login. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The customer user object to be modified. + +```yaml +Type: PSCustomerUser +Parameter Sets: UserObject +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -LastName +User's last name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +User's new password. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserId +Identifier for the user. + +```yaml +Type: String +Parameter Sets: UserId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserPrincipalName +User principal name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + +## OUTPUTS + +### Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerLegalProfile.md b/docs/help/Set-PartnerLegalProfile.md new file mode 100644 index 0000000..8e15891 --- /dev/null +++ b/docs/help/Set-PartnerLegalProfile.md @@ -0,0 +1,244 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerLegalProfile + +## SYNOPSIS +Updates the partner's legal profile. + +## SYNTAX + +``` +Set-PartnerLegalProfile [-AddressLine1 ] [-AddressLine2 ] [-City ] [-Country ] + [-EmailAddress ] [-FirstName ] [-LastName ] [-PhoneNumber ] + [-PostalCode ] [-Region ] [-State ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates the partner's legal profile. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-PartnerLegalProfile -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -PostalCode '98004' -State 'WA' +``` + +Updates the partner's legal profile. + +## PARAMETERS + +### -AddressLine1 +The first line of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AddressLine2 +The second line of the adress. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -City +The city portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Country +The country portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EmailAddress +The email address of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirstName +The first name of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastName +The last name of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PhoneNumber +The phone number of the primary billing contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PostalCode +The postal code portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Region +The region portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +The state portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSLegalBusinessProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerOrganizationProfile.md b/docs/help/Set-PartnerOrganizationProfile.md new file mode 100644 index 0000000..7ea7d35 --- /dev/null +++ b/docs/help/Set-PartnerOrganizationProfile.md @@ -0,0 +1,275 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerOrganizationProfile + +## SYNOPSIS +Updates the partner's organization profile + +## SYNTAX + +``` +Set-PartnerOrganizationProfile [-CompanyName ] [-AddressLine1 ] [-AddressLine2 ] + [-City ] [-Country ] [-Culture ] [-Email ] [-FirstName ] + [-Language ] [-LastName ] [-PhoneNumber ] [-PostalCode ] [-State ] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates the partner's organization profile + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-PartnerOrganizationProfile -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -PostalCode '98004' -State 'WA' +``` + +Updates the partner's organization profile + +## PARAMETERS + +### -AddressLine1 +The first line of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AddressLine2 +The second line of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -City +The city portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CompanyName +The company name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Country +The country portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Culture +The preferred organization culture. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Email +The organization technical contact's email address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirstName +The primary organization contact's first name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Language +The primary organization language. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastName +The primary organization contact's last name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PhoneNumber +The primary organization contact's phone number. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PostalCode +The postal code of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +The state portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSOrganizationProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Set-PartnerSupportProfile.md b/docs/help/Set-PartnerSupportProfile.md new file mode 100644 index 0000000..1d28970 --- /dev/null +++ b/docs/help/Set-PartnerSupportProfile.md @@ -0,0 +1,123 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Set-PartnerSupportProfile + +## SYNOPSIS +Updates the partner's support profile. + +## SYNTAX + +``` +Set-PartnerSupportProfile [-SupportEmail ] [-SupportPhoneNumber ] [-SupportWebsite ] + [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Updates the partner's support profile. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-PartnerSupportProfile -SupportEmail 'support@contoso.com' -SupportPhoneNumber '4255555555' -SupportWebsite 'https://www.microsoft.com' +``` + +Updates the partner's support profile. + +## PARAMETERS + +### -SupportEmail +The email address of the support contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SupportPhoneNumber +The phone number of the support contact. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SupportWebsite +The website where customers can get support. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Partners.PSSupportProfile + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Submit-PartnerCustomerCart.md b/docs/help/Submit-PartnerCustomerCart.md new file mode 100644 index 0000000..b315e1c --- /dev/null +++ b/docs/help/Submit-PartnerCustomerCart.md @@ -0,0 +1,107 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Submit-PartnerCustomerCart + +## SYNOPSIS +Checks out the specified cart. + +## SYNTAX + +``` +Submit-PartnerCustomerCart -CartId -CustomerId [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Checks out the specified cart. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Submit-PartnerCustomerCart -CartId '65faf57b-0205-47ee-92b3-08dcf233ea73' -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' +``` + +Checks out the specified cart. + +## PARAMETERS + +### -CartId +The identifier for the cart. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CustomerId +The identifier for the customer. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### Microsoft.Store.PartnerCenter.PowerShell.Models.Carts.PSCartCheckoutResult + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Test-PartnerAddress.md b/docs/help/Test-PartnerAddress.md new file mode 100644 index 0000000..0cbc0e8 --- /dev/null +++ b/docs/help/Test-PartnerAddress.md @@ -0,0 +1,183 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Test-PartnerAddress + +## SYNOPSIS +Tests whether or not the specified address is valid. + +## SYNTAX + +``` +Test-PartnerAddress -AddressLine1 [-AddressLine2 ] [-City ] [-Country ] + -PostalCode [-Region ] [-State ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Tests whether or not the specified address is valid. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Test-PartnerAddress -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -Country 'US' -PostalCode '98004' -State 'WA' +``` + +Tests whether or not the specified address is valid. + +## PARAMETERS + +### -AddressLine1 +The first line of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AddressLine2 +The second line of the adress. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -City +The city portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Country +The country portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PostalCode +The postal code portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Region +The region portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +The state portion of the address. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/help/Test-PartnerDomainAvailability.md b/docs/help/Test-PartnerDomainAvailability.md new file mode 100644 index 0000000..43d7ce7 --- /dev/null +++ b/docs/help/Test-PartnerDomainAvailability.md @@ -0,0 +1,63 @@ +--- +external help file: Microsoft.Store.PartnerCenter.PowerShell.dll-Help.xml +Module Name: PartnerCenter +online version: +schema: 2.0.0 +--- + +# Test-PartnerDomainAvailability + +## SYNOPSIS +Tests if the specified domain name is available for creating a new tenant + +## SYNTAX + +``` +Test-PartnerDomainAvailability [-Domain] [] +``` + +## DESCRIPTION + +The Test-PartnerDomainAvailability cmdlet tests to see if the specified domain name is available for creating a new tenant. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Test-PartnerDomainAvailability -Domain 'contoso.onmicrosoft.com' +``` + +Tests if the domain contoso.onmicrosoft.com is available. Returns true if yes, false otherwise. + +## PARAMETERS + +### -Domain +A string that identifies the domain to check, e.g. +"contoso.onmicrosoft.com" . + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +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 + +### System.Boolean + +## NOTES + +## RELATED LINKS diff --git a/docs/scenarios.md b/docs/scenarios.md new file mode 100644 index 0000000..d6af0bb --- /dev/null +++ b/docs/scenarios.md @@ -0,0 +1,24 @@ +# Scenarios + +## Applies To + +- Partner Center +- Partner Center operated by 21Vianet +- Partner Center for Microsoft Cloud Germany +- Partner Center for Microsoft Cloud for US Government + +This section describes ways that partners in the Cloud Solution Provider program can use the Partner Center PowerShell module to manage billing, customer accounts, orders, partner accounts, subscriptions, and support. + +## Scenarios supported by the Partner Center PowerShell Module + +### Manage customer accounts + +#### Manage customer account details + +- [Confirm customer acceptance of Microsoft Cloud agreement](scenarios/confirm-customer-consent.md) + +### Place orders + +#### Purchase Azure Reserved VM Instances + +- [Purchase Azure reservations](scenarios/purchase-azure-reservations.md) \ No newline at end of file diff --git a/docs/scenarios/confirm-customer-consent.md b/docs/scenarios/confirm-customer-consent.md new file mode 100644 index 0000000..de479ce --- /dev/null +++ b/docs/scenarios/confirm-customer-consent.md @@ -0,0 +1,39 @@ +# Confirm customer acceptance of Microsoft Cloud agreement + +## Applies To + +- Partner Center + +> [!NOTE] +> The **Agreement** resource is currently supported by Partner Center in the Microsoft public cloud only. It is not applicable to: +> - Partner Center operated by 21Vianet +> - Partner Center for Microsoft Cloud Germany +> - Partner Center for Microsoft Cloud for US Government + +How to confirm customer acceptance of the Microsoft Cloud agreement. + +## Prerequisites + +- A customer identifier (customer-tenant-id). +- Date when customer accepted the Microsoft Cloud Agreement. +- Information about the user from the organization who accepted the Microsoft Cloud Agreement, including: + - First name + - Last name + - Email address + - Phone number (optional) + +## Examples + +Follow these steps to confirm or reconfirm a customer has accepted the Microsoft Cloud Agreement: + +1. Run the [Get-PartnerAgreementDetail](../help/Get-PartnerAgreementDetail.md) cmdlet to retrieve the **Template Id** for the agreement. + + ```powershell + Get-PartnerAgreementDetail + ``` + +2. Run the [New-PartnerCustomerAgreement](../help/New-PartnerCustomerAgreement.md) cmdlet and supply the **Template Id**, **Customer Id**, and details on the person who accepted the Microsoft Cloud Agreement for the customer. + + ```powershell + New-PartnerCustomerAgreement -TemplateId ''-AgreementType MicrosoftCloudAgreement -CustomerId '' -ContactEmail '' -ContactFirstName '' -ContactLastName '' + ``` \ No newline at end of file diff --git a/docs/scenarios/purchase-azure-reservations.md b/docs/scenarios/purchase-azure-reservations.md new file mode 100644 index 0000000..ec6aa9a --- /dev/null +++ b/docs/scenarios/purchase-azure-reservations.md @@ -0,0 +1,84 @@ +# Purchase Azure reservations + +## Applies To + +- Partner Center + +To purchase an Azure reservation using the Partner Center PowerShell module, you must have one or more deployed Cloud Solution Provider (CSP) Azure subscriptions. If you do not have a CSP Azure subscription, follow these steps to purchase one: + +- Get a list of offers for a market. +- Create an order for an CSP Azure subscription. +- Submit the order +- Verify that the order is fulfilled. + +> **NOTE** +> Azure Reserved VM Instances are not available in all markets, please check for the latest list of markets where Reserved VM instances are available. + +## How to purchase Microsoft Azure reservations + +After you have identified an active CSP Azure subscription for which to add the Azure reservation, use the following steps to complete the RI purchase: + +1. [Enablement](#enablement) - Register an active CSP Azure subscription to enable it for purchasing Azure reservations. +2. [Discovery](#discovery) - Find and select the Azure reservation products and SKUs you want to purchase and check their availability. +3. [Order submission](#order_submission) - Create a shopping cart with the items in your order and submit it. + +### Enablement + +Once you have identified the active subscription for which to add the Azure reservation, you must register the subscription to enable Azure reservations. To register an existing subscription, run the [New-PartnerCustomerSubscriptionRegistration](../help/NewPartnerCustomerSubscriptionRegistration.md) cmdlet + +```powershell +New-PartnerCustomerSubscriptionRegistration -CustomerId '' -SubscriptionId '' +``` + +After registering the subscription, confirm that the registration completed successfully by checking the registration status. To do this, run the [Get-PartnerCustomerSubscriptionRegistrationStatus](../help/GetPartnerCustomerSubscriptionRegistrationStatus.md) cmdlet + +```powershell +Get-PartnerCustomerSubscriptionRegistrationStatus -CustomerId '' -SubscriptionId '' +``` + +### Discovery + +Once the subscription is enabled for purchasing Azure reservations, you need the Product identifiers and SKUs for the Reserved VM Instances. You must also verify that the SKUs are in inventory and available. To retrieve the product identifiers, SKUs, and to verify inventory and availability, complete the following steps: + +1. Identify the Product and SKU information for the Reserved VM Instance that you will purchase. To do this, run the [Get-PartnerProduct](../help/Get-PartnerProduct.md) and [Get-PartnerProductSku](../help/Get-PartnerProductSku.md) cmdlets. + + ```powershell + Get-PartnerProduct -Catalog 'Azure' -Segment 'commercial' + ``` + + ```powershell + Get-PartnerProductSku -ProductId '' + ``` + +2. Verify SKU​ inventory for each one that is tagged with a **InventoryCheck** prerequisite​. To do this, run the [Get-PartnerProductInventory](../help/Get-PartnerProductInventory.md) cmdlet. + + ```powershell + $variables = @{ customerId=''; azureSubscriptionId=''; armRegionName='' } + + Get-PartnerProductInventory -ProductId '' -Variables $variables + ``` + +3. View the SKU availability and make note of the corresponding **CatalogItemId**​. To get this value, run the [Get-PartnerProductAvailability](../help/Get-PartnerProductAvailability.md) cmdlet. + + ```powershell + Get-PartnerProductAvailability -Product '' -SkuId '' + ``` + +### Order submission + +To submit your Azure reservation order, do the following: + +1. Create a cart to hold the collection of catalog items that you intend to buy. When you create a cart, the cart line items are automatically grouped based on what can be purchased in the same order. To do this, run the [New-PartnerCustomerCart](../help/New-PartnerCustomerCart.md) cmdlet. + + ```powershell + $lineItems = @() + $lineItems += New-PartnerCustomerCartLineItem -BillingCycle 'OneTime' -CatalogItemId '' -CustomerId '' -FriendlyName '' -ProvisioningContext @{duration='1Year'; scope='shared'; subscriptionId=''} -Quantity 1 + + New-PartnerCustomerCart -CustomerId '' -LineItems $lineItems + ``` + +2. Submit the cart. Checking out (submitting) a cart results in an order. To do this, run the [Submit-PartnerCustomerCart](../help/Submit-PartnerCustomerCart.md) cmdlet. + + ```powershell + Submit-PartnerCustomerCart -CartId '' -CustomerId '' + ``` \ No newline at end of file diff --git a/src/PowerShell/Authentication/EnvironmentConstants.cs b/src/PowerShell/Authentication/EnvironmentConstants.cs new file mode 100644 index 0000000..18c7ea2 --- /dev/null +++ b/src/PowerShell/Authentication/EnvironmentConstants.cs @@ -0,0 +1,35 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Authentication +{ + /// + /// Known endpoint values for accessing cloud based resources. + /// + public static class EnvironmentConstants + { + /// + /// The Azure Active Directory authentication endpoint + /// + public const string AzureActiveDirectoryEndpoint = "https://login.microsoftonline.com/"; + public const string ChinaActiveDirectoryEndpoint = "https://login.chinacloudapi.cn/"; + public const string GermanActiveDirectoryEndpoint = "https://login.microsoftonline.de/"; + public const string USGovernmentActiveDirectoryEndpoint = "https://login.microsoftonline.us/"; + + /// + /// The Azure Active Directory Graph endpoint + /// + public const string AzureGraphEndpoint = "https://graph.windows.net/"; + public const string ChinaGraphEndpoint = "https://graph.chinacloudapi.cn/"; + public const string GermanGraphEndpoint = "https://graph.cloudapi.de/"; + public const string USGovernmentGraphEndpoint = "https://graph.windows.net/"; + + /// + /// The Partner Center endpoint + /// + public const string PartnerCenterEndpoint = "https://api.partnercenter.microsoft.com"; + } +} \ No newline at end of file diff --git a/src/PowerShell/Authentication/EnvironmentName.cs b/src/PowerShell/Authentication/EnvironmentName.cs new file mode 100644 index 0000000..dc7e017 --- /dev/null +++ b/src/PowerShell/Authentication/EnvironmentName.cs @@ -0,0 +1,34 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Authentication +{ + /// + /// Collection of names for the available instances of Microsoft Partner Center. + /// + public enum EnvironmentName + { + /// + /// The global instance of Microsoft Partner Center. + /// + GlobalCloud, + + /// + /// The Chinese sovereign cloud instance of Microsoft Partner Center. + /// + ChinaCloud, + + /// + /// The German sovereign cloud instance of Microsoft Partner Center. + /// + GermanCloud, + + /// + /// The US Government sovereign cloud instance of Microsoft Partner Center. + /// + USGovernment + } +} \ No newline at end of file diff --git a/src/PowerShell/Authentication/PartnerContext.cs b/src/PowerShell/Authentication/PartnerContext.cs new file mode 100644 index 0000000..b6cfc11 --- /dev/null +++ b/src/PowerShell/Authentication/PartnerContext.cs @@ -0,0 +1,52 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Authentication +{ + using System; + + /// + /// Partner and user details used by the Partner Center cmdlets. + /// + [Serializable] + public class PartnerContext + { + /// + /// Gets or sets the application identifier. + /// + public string ApplicationId { get; set; } + + /// + /// Gets or sets the ISO2 country code. + /// + public string CountryCode { get; set; } + + /// + /// Gets or set the envrionment. + /// + public EnvironmentName Environment { get; set; } + + /// + /// Gets or sets the locale of the authenicated user. + /// + public string Locale { get; set; } + + /// + /// Gets or sets the tenant identifier. + /// + public string TenantId { get; set; } + + /// + /// Gets or sets the user identifier. + /// + public string UserId { get; set; } + + /// + /// Gets or sets the user name. + /// + public string Username { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Authentication/PartnerEnvironment.cs b/src/PowerShell/Authentication/PartnerEnvironment.cs new file mode 100644 index 0000000..dc73f8d --- /dev/null +++ b/src/PowerShell/Authentication/PartnerEnvironment.cs @@ -0,0 +1,87 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Authentication +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + + /// + /// A record of metadata necessary to manage assets in a specific azure cloud, including necessary endpoints, + /// location of service-specific endpoints, and information for bootstrapping authentication + /// + [Serializable] + public class PartnerEnvironment + { + /// + /// Gets or sets the authentication endpoint. + /// + public string ActiveDirectoryAuthority { get; set; } + + /// + /// Gets or sets the Azure AD Graph endpoint. + /// + public string AzureAdGraphEndpoint { get; set; } + + /// + /// Gets the Partner Center endpoint. + /// + public string PartnerCenterEndpoint { get; set; } + + /// + /// Gets the defined Microsoft Partner Center environments. + /// + public static IDictionary PublicEnvironments { get; } = InitializeEnvironments(); + + /// + /// Gets or sets the name of the tenant in this environment. + /// + public string Tenant { get; set; } + + /// + /// Initializes a list of known environments. + /// + /// A dictionary containing the known environments. + private static IDictionary InitializeEnvironments() + { + return new ConcurrentDictionary + { + [EnvironmentName.GlobalCloud] = new PartnerEnvironment + { + ActiveDirectoryAuthority = EnvironmentConstants.AzureActiveDirectoryEndpoint, + AzureAdGraphEndpoint = EnvironmentConstants.AzureGraphEndpoint, + PartnerCenterEndpoint = EnvironmentConstants.PartnerCenterEndpoint, + Tenant = "Common" + }, + + [EnvironmentName.ChinaCloud] = new PartnerEnvironment + { + ActiveDirectoryAuthority = EnvironmentConstants.ChinaActiveDirectoryEndpoint, + AzureAdGraphEndpoint = EnvironmentConstants.ChinaGraphEndpoint, + PartnerCenterEndpoint = EnvironmentConstants.PartnerCenterEndpoint, + Tenant = "Common" + }, + + [EnvironmentName.USGovernment] = new PartnerEnvironment + { + ActiveDirectoryAuthority = EnvironmentConstants.USGovernmentActiveDirectoryEndpoint, + AzureAdGraphEndpoint = EnvironmentConstants.USGovernmentGraphEndpoint, + PartnerCenterEndpoint = EnvironmentConstants.PartnerCenterEndpoint, + Tenant = "Common" + }, + + [EnvironmentName.GermanCloud] = new PartnerEnvironment + { + ActiveDirectoryAuthority = EnvironmentConstants.GermanActiveDirectoryEndpoint, + AzureAdGraphEndpoint = EnvironmentConstants.GermanGraphEndpoint, + PartnerCenterEndpoint = EnvironmentConstants.PartnerCenterEndpoint, + Tenant = "Common" + } + }; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Authentication/PartnerProfile.cs b/src/PowerShell/Authentication/PartnerProfile.cs new file mode 100644 index 0000000..64f5b43 --- /dev/null +++ b/src/PowerShell/Authentication/PartnerProfile.cs @@ -0,0 +1,31 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Authentication +{ + using System; + + /// + /// Represents a profile structure with context and environments. + /// + public class PartnerProfile + { + /// + /// Singleton instance of the class. + /// + private static readonly Lazy instance = new Lazy(() => new PartnerProfile()); + + /// + /// Gets or sets the context. + /// + public PartnerContext Context { get; set; } + + /// + /// Gets an instance of the class. + /// + public static PartnerProfile Instance => instance.Value; + } +} \ No newline at end of file diff --git a/src/PowerShell/Authentication/PartnerSession.cs b/src/PowerShell/Authentication/PartnerSession.cs new file mode 100644 index 0000000..cd3c0c5 --- /dev/null +++ b/src/PowerShell/Authentication/PartnerSession.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Authentication +{ + using System; + using Factories; + + /// + /// Represents the current partner session. + /// + public class PartnerSession + { + /// + /// Singleton instance of the class. + /// + private static readonly Lazy partnerSession = new Lazy(); + + /// + /// Gets or sets an instance of the authentication factory. + /// + public IAuthenticationFactory AuthenticationFactory { get; set; } + + /// + /// Gets or sets an instance of the client facotry. + /// + public IClientFactory ClientFactory { get; set; } + + /// + /// Gets an instance of the class. + /// + public static PartnerSession Instance => partnerSession.Value; + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/AddPartnerCustomerCartLineItem.cs b/src/PowerShell/Commands/AddPartnerCustomerCartLineItem.cs new file mode 100644 index 0000000..03da15f --- /dev/null +++ b/src/PowerShell/Commands/AddPartnerCustomerCartLineItem.cs @@ -0,0 +1,80 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models.Carts; + using PartnerCenter.Models.Carts; + using Properties; + + /// + /// Adds a cart line item to the specified cart. + /// + [Cmdlet(VerbsCommon.Add, "PartnerCustomerCartLineItem", SupportsShouldProcess = true), OutputType(typeof(PSCart))] + public class AddPartnerCustomerCartLineItem : PartnerPSCmdlet + { + /// + /// Gets or sets the required cart identifier. + /// + [Parameter(HelpMessage = "The identifier for the cart.", Mandatory = true)] + [ValidateNotNull] + public string CartId { get; set; } + + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the line item to be added. + /// + [Parameter(HelpMessage = "The line item to be added.", Mandatory = true)] + [ValidateNotNull] + public PSCartLineItem LineItem { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Cart cart; + CartLineItem cartLineItem; + List lineItems; + + try + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.AddPartnerCustomerCartLineItemWhatIf, CartId))) + { + cart = Partner.Customers[CustomerId].Carts[CartId].Get(); + lineItems = cart.LineItems.ToList(); + + cartLineItem = new CartLineItem(); + cartLineItem.CopyFrom(LineItem); + + lineItems.Add(cartLineItem); + + cart = Partner.Customers[CustomerId].Carts[CartId].Put(cart); + + WriteObject(new PSCart(cart)); + } + } + finally + { + cart = null; + cartLineItem = null; + lineItems = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/AddPartnerCustomerUserRoleMember.cs b/src/PowerShell/Commands/AddPartnerCustomerUserRoleMember.cs new file mode 100644 index 0000000..354b319 --- /dev/null +++ b/src/PowerShell/Commands/AddPartnerCustomerUserRoleMember.cs @@ -0,0 +1,105 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Exceptions; + using PartnerCenter.Models.Roles; + using PartnerCenter.Models.Users; + + /// + /// Gets a list of roles for the specified customer user from Partner Center. + /// + [Cmdlet(VerbsCommon.Add, "PartnerCustomerUserRoleMember"), OutputType(typeof(bool))] + public class AddPartnerCustomerUserRoleMember : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the user identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier for the customer user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the role identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier for the role.")] + [ValidateNotNull] + public string RoleId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + UserId.AssertNotEmpty(nameof(UserId)); + RoleId.AssertNotEmpty(nameof(RoleId)); + + CustomerUser user = GetUserById(CustomerId, UserId); + + try + { + UserMember newMember = new UserMember() + { + UserPrincipalName = user.UserPrincipalName, + DisplayName = user.DisplayName, + Id = user.Id + }; + + Partner.Customers[CustomerId].DirectoryRoles[RoleId].UserMembers.Create(newMember); + WriteObject(true); + } + catch (PSPartnerException ex) + { + throw new PSPartnerException($"Error adding user {UserId} to role {RoleId}", ex); + } + finally + { + user = null; + } + } + + /// + /// Gets details for a specified user and customer from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// + private CustomerUser GetUserById(string customerId, string userId) + { + CustomerUser user; + + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + + try + { + user = Partner.Customers[customerId].Users[userId].Get(); + return user; + } + catch (PSPartnerException ex) + { + throw new PSPartnerException("Error finding user:" + userId, ex); + } + finally + { + user = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/ConnectPartnerCenter.cs b/src/PowerShell/Commands/ConnectPartnerCenter.cs new file mode 100644 index 0000000..77ebc9d --- /dev/null +++ b/src/PowerShell/Commands/ConnectPartnerCenter.cs @@ -0,0 +1,98 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Security; + using Authentication; + using Factories; + using Properties; + + /// + /// Cmdlet to log into a Partner Center environment. + /// + [Cmdlet(VerbsCommunications.Connect, "PartnerCenter"), OutputType(typeof(PartnerContext))] + public class ConnectPartnerCenter : PSCmdlet, IModuleAssemblyInitializer + { + /// + /// Gets or sets the application identifier used to access the Partner Center API. + /// + [Parameter(Mandatory = true, HelpMessage = "The application identifier used to access the Partner Center API.")] + public string ApplicationId { get; set; } + + /// + /// Gets or sets the optional user credentials to used during the authentication request. + /// + /// + /// If this parameter is not specified then the user will be prompted for credentials. + /// + [Parameter(Mandatory = false, ParameterSetName = "UserCredential")] + public PSCredential Credential { get; set; } + + /// + /// Gets or sets the optional envrionment name used during the authentication request. + /// + /// + /// If this parameter is not specified the default Global Cloud envrionment will be used. + /// + [Parameter(Mandatory = false, HelpMessage = "Name of the environment containing the account to log into")] + [Alias("EnvironmentName")] + [ValidateNotNullOrEmpty] + public EnvironmentName Environment { get; set; } + + /// + /// Operations that happen before the cmdlet is executed. + /// + protected override void BeginProcessing() + { + if (!PartnerEnvironment.PublicEnvironments.ContainsKey(Environment)) + { + throw new PSInvalidOperationException(Resources.InvalidEnvironmentException); + } + } + + /// + /// Operations that are performed when the Partner Center module is imported. + /// + public void OnImport() + { + if (PartnerSession.Instance.AuthenticationFactory == null) + { + PartnerSession.Instance.AuthenticationFactory = new AuthenticationFactory(); + } + + if (PartnerSession.Instance.ClientFactory == null) + { + PartnerSession.Instance.ClientFactory = new ClientFactory(); + } + } + + /// + /// Performs the execution of the command. + /// + protected override void ProcessRecord() + { + SecureString password = null; + string username = string.Empty; + + if (Credential != null) + { + password = Credential.Password; + username = Credential.UserName; + } + + PartnerProfile.Instance.Context = PartnerSession.Instance.AuthenticationFactory.Authenticate( + ApplicationId, + Environment, + username, + password, + "common"); + + WriteObject(PartnerProfile.Instance.Context); + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerAgreementDetail.cs b/src/PowerShell/Commands/GetPartnerAgreementDetail.cs new file mode 100644 index 0000000..3f47dee --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerAgreementDetail.cs @@ -0,0 +1,40 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using Models.Agreements; + using PartnerCenter.Models; + using PartnerCenter.Models.Agreements; + + /// + /// Gets a metadata for the available agreements. + /// + [Cmdlet(VerbsCommon.Get, "PartnerAgreementDetail"), OutputType(typeof(PSAgreementMetaData))] + public class GetPartnerAgreementDetail : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection agreements; + + try + { + agreements = Partner.AgreementDetails.Get(); + + WriteObject(agreements.Items.Select(a => new PSAgreementMetaData(a)), true); + } + finally + { + agreements = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerAuditRecord.cs b/src/PowerShell/Commands/GetPartnerAuditRecord.cs new file mode 100644 index 0000000..9fbc27e --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerAuditRecord.cs @@ -0,0 +1,90 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Enumerators; + using Models.Auditing; + using PartnerCenter.Models; + using PartnerCenter.Models.Auditing; + using Properties; + + /// + /// Cmdlet that retrieves audit records from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerAuditRecord"), OutputType(typeof(PSAuditRecord))] + public class GetPartnerAuditRecord : PartnerPSCmdlet + { + /// + /// Gets or sets the end date porition of the query. + /// + [Parameter(HelpMessage = "The end date of the audit record logs.", Mandatory = false)] + public DateTime? EndDate { get; set; } + + /// + /// Gets or sets the start date porition of the query. + /// + [Parameter(HelpMessage = "The start date of the audit record logs.", Mandatory = false)] + public DateTime StartDate { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + DateTime endDate; + IResourceCollectionEnumerator> enumerator; + List records; + SeekBasedResourceCollection auditRecords; + + try + { + endDate = EndDate ?? DateTime.Now; + + if ((endDate - StartDate).Days >= 90) + { + throw new PSInvalidOperationException(Resources.AuditRecordDateError); + } + + records = new List(); + + foreach (DateTime date in ChunkDate(StartDate, endDate, 30)) + { + auditRecords = Partner.AuditRecords.Query( + date); + + enumerator = Partner.Enumerators.AuditRecords.Create(auditRecords); + + while (enumerator.HasValue) + { + records.AddRange(enumerator.Current.Items.Select(r => new PSAuditRecord(r))); + enumerator.Next(); + } + } + + WriteObject(records, true); + } + finally + { + auditRecords = null; + } + } + + private static IEnumerable ChunkDate(DateTime startDate, DateTime endDate, int size) + { + while (startDate < endDate) + { + yield return startDate; + + startDate = startDate.AddDays(size); + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerAzureRateCard.cs b/src/PowerShell/Commands/GetPartnerAzureRateCard.cs new file mode 100644 index 0000000..63e85fd --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerAzureRateCard.cs @@ -0,0 +1,63 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.RateCards; + using PartnerCenter.Models.RateCards; + + /// + /// Cmdlet that retrieves Azrue Rate Card details. + /// + [Cmdlet(VerbsCommon.Get, "PartnerAzureRateCard"), OutputType(typeof(PSAzureRateCard))] + public class GetPartnerAzureRateCard : PartnerPSCmdlet + { + /// + /// Gets or sets the identifier of the customer. + /// + [Parameter(Mandatory = false, HelpMessage = "An optional three letter ISO code for the currency in which the resource rates will be provided.")] + public string Currency { get; set; } + + /// + /// Gets or sets the offer category. + /// + [Parameter(Mandatory = false, HelpMessage = "An optional two-letter ISO country/region code that indicates the market where the offer is purchased.")] + public string Region { get; set; } + + /// + /// Gets or sets a flag indicating whether or not to retrieve the Azure Rate Card for Azure Partner Shared Services (APSS). + /// + [Parameter(Mandatory = false, HelpMessage = "Flag indicating whether or not to retrieve the Azure Rate Card for Azure Partner Shared Services (APSS).")] + public SwitchParameter SharedServices { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + AzureRateCard rateCard; + + try + { + if (SharedServices.IsPresent && SharedServices.ToBool()) + { + rateCard = Partner.RateCards.Azure.GetShared(Currency, Region); + } + else + { + rateCard = Partner.RateCards.Azure.Get(Currency, Region); + } + + WriteObject(new PSAzureRateCard(rateCard)); + } + finally + { + rateCard = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerBillingProfile.cs b/src/PowerShell/Commands/GetPartnerBillingProfile.cs new file mode 100644 index 0000000..0d8397d --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerBillingProfile.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.Partners; + using PartnerCenter.Models.Partners; + + /// + /// Gets the partner billing profile from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerBillingProfile"), OutputType(typeof(PSBillingProfile))] + public class GetPartnerBillingProfile : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + BillingProfile profile; + + try + { + profile = Partner.Profiles.BillingProfile.Get(); + + WriteObject(new PSBillingProfile(profile)); + } + finally + { + profile = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCountryValidation.cs b/src/PowerShell/Commands/GetPartnerCountryValidation.cs new file mode 100644 index 0000000..710195b --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCountryValidation.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.CountryValidationRules; + using PartnerCenter.Models.CountryValidationRules; + + [Cmdlet(VerbsCommon.Get, "PartnerCountryValidation"), OutputType(typeof(PSCountryValidationRules))] + public class GetPartnerCountryValidation : PartnerPSCmdlet + { + [Parameter(Mandatory = true, HelpMessage = "The country code in ISO2 format.")] + public string CountryCode { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CountryValidationRules rules; + + try + { + rules = Partner.CountryValidationRules.ByCountry(CountryCode).Get(); + WriteObject(new PSCountryValidationRules(rules)); + } + finally + { + rules = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomer.cs b/src/PowerShell/Commands/GetPartnerCustomer.cs new file mode 100644 index 0000000..7840c97 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomer.cs @@ -0,0 +1,110 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Enumerators; + using Models.Customers; + using PartnerCenter.Models; + using PartnerCenter.Models.Customers; + + /// + /// Get a customer, or a list of customers, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomer"), OutputType(typeof(PSCustomer))] + public class GetPartnerCustomer : PartnerPSCmdlet + { + /// + /// Gets or sets the optional customer identifier. + /// + /// + /// If this parameter is not specified then a list of customers will be returned. + /// When it is specified then the customer associated with the identifier will be returned. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = false, Position = 0)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(CustomerId)) + { + GetCustomers(); + } + else + { + GetCustomer(CustomerId); + } + } + + /// + /// Gets the specified customer from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private void GetCustomer(string customerId) + { + Customer customer; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + customer = Partner.Customers[customerId].Get(); + + WriteObject(new PSCustomer(customer)); + } + finally + { + customer = null; + } + } + + /// + /// Gets a list of customers from Partner Center. + /// + /// + /// The maximum number of customers returned by the Partner Center API in a single call is 500. + /// So, we will need to use an enumerator to return all the available customers. + /// + private void GetCustomers() + { + IResourceCollectionEnumerator> customersEnumerator; + List customers; + SeekBasedResourceCollection seekCustomers; + + try + { + customers = new List(); + + seekCustomers = Partner.Customers.Get(); + customersEnumerator = Partner.Enumerators.Customers.Create(seekCustomers); + + while (customersEnumerator.HasValue) + { + customers.AddRange(customersEnumerator.Current.Items); + customersEnumerator.Next(); + } + + WriteObject(customers.Select(c => new PSCustomer(c)), true); + } + finally + { + customers = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerAgreement.cs b/src/PowerShell/Commands/GetPartnerCustomerAgreement.cs new file mode 100644 index 0000000..c311784 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerAgreement.cs @@ -0,0 +1,48 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Agreements; + using PartnerCenter.Models; + using PartnerCenter.Models.Agreements; + + /// + /// Gets a list of agreements the customer in place. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerAgreement"), OutputType(typeof(PSAgreement))] + public class GetPartnerCustomerAgreement : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection agreements; + + try + { + agreements = Partner.Customers[CustomerId].Agreements.Get(); + + WriteObject(agreements.Items.Select(a => new PSAgreement(a)), true); + } + finally + { + agreements = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerCart.cs b/src/PowerShell/Commands/GetPartnerCustomerCart.cs new file mode 100644 index 0000000..01a54a9 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerCart.cs @@ -0,0 +1,50 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Carts; + using PartnerCenter.Models.Carts; + + [Cmdlet(VerbsCommon.Get, "PartnerCustomerCart"), OutputType(typeof(PSCart))] + public class GetPartnerCustomerCart : PartnerPSCmdlet + { + /// + /// Gets or sets the required cart identifier. + /// + [Parameter(HelpMessage = "The identifier for the cart.", Mandatory = true)] + [ValidateNotNull] + public string CartId { get; set; } + + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Cart cart; + + try + { + cart = Partner.Customers[CustomerId].Carts[CartId].Get(); + + WriteObject(new PSCart(cart)); + } + finally + { + cart = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerConfigurationPolicy.cs b/src/PowerShell/Commands/GetPartnerCustomerConfigurationPolicy.cs new file mode 100644 index 0000000..3d83fb6 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerConfigurationPolicy.cs @@ -0,0 +1,107 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models; + using PartnerCenter.Models.DevicesDeployment; + + /// + /// Return a list of configuration policies or a specific configration policy for the specified customer identifier. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerConfigurationPolicy"), OutputType(typeof(PSConfigurationPolicy))] + public class GetPartnerCustomerConfigurationPolicy : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional configuration policy identifier. + /// + /// + /// If this parameter is not specified then a list of all policies for the specified customer will be returned. + /// When it is specified then the policy associated with the identifier will be returned. + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier for the configuration policy.")] + [ValidateNotNullOrEmpty] + public string PolicyId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(PolicyId)) + { + GetCustomerPolicies(CustomerId); + } + else + { + GetCustomerPolicy(CustomerId, PolicyId); + } + } + + /// + /// Gets the configuration policies for the specified customer from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private void GetCustomerPolicies(string customerId) + { + IEnumerable devicePolicy; + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + devicePolicy = Partner.Customers[customerId].ConfigurationPolicies.Get().Items; + WriteObject(devicePolicy.Select(d => new PSConfigurationPolicy(d)), true); + } + finally + { + devicePolicy = null; + } + } + + /// + /// Gets the specified policy from the specified customer from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the policy. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetCustomerPolicy(string customerId, string policyId) + { + ConfigurationPolicy devicePolicy; + + customerId.AssertNotEmpty(nameof(customerId)); + policyId.AssertNotEmpty(nameof(policyId)); + + try + { + devicePolicy = Partner.Customers[customerId].ConfigurationPolicies[policyId].Get(); + WriteObject(new PSConfigurationPolicy(devicePolicy), true); + } + finally + { + devicePolicy = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerDevice.cs b/src/PowerShell/Commands/GetPartnerCustomerDevice.cs new file mode 100644 index 0000000..8664d69 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerDevice.cs @@ -0,0 +1,59 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.DevicesDeployment; + using PartnerCenter.Models.DevicesDeployment; + + /// + /// Return a list of devices in the specified device batch for the specified customer. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerDevice"), OutputType(typeof(PSDevice))] + public class GetPartnerCustomerDevice : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + /// + /// + [Parameter(Mandatory = true, Position =0, HelpMessage = "Identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the batch identifier. + /// + /// + /// + [Parameter(Mandatory = true, HelpMessage = "Identifier for the device batch.")] + [ValidateNotNullOrEmpty] + public string BatchId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + IEnumerable devices; + + try + { + devices = Partner.Customers[CustomerId].DeviceBatches[BatchId].Devices.Get().Items; + WriteObject(devices.Select(d => new PSDevice(d)), true); + } + finally + { + devices = null; + } + } + + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerDeviceBatch.cs b/src/PowerShell/Commands/GetPartnerCustomerDeviceBatch.cs new file mode 100644 index 0000000..889686d --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerDeviceBatch.cs @@ -0,0 +1,47 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.DevicesDeployment; + using PartnerCenter.Models.DevicesDeployment; + + /// + /// Gets a colletion of device batches from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerDeviceBatch"), OutputType(typeof(PSDeviceBatch))] + public class GetPartnerCustomerDeviceBatch : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + IEnumerable deviceBatch; + + try + { + deviceBatch = Partner.Customers[CustomerId].DeviceBatches.Get().Items; + WriteObject(deviceBatch.Select(db => new PSDeviceBatch(db)), true); + } + finally + { + deviceBatch = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerEntitlement.cs b/src/PowerShell/Commands/GetPartnerCustomerEntitlement.cs new file mode 100644 index 0000000..a2d1852 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerEntitlement.cs @@ -0,0 +1,102 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models.Entitlements; + using PartnerCenter.Models.Entitlements; + + /// + /// Gets a list of entitlements for a customer from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerEntitlement"), OutputType(typeof(PSEntitlement))] + public class GetPartnerCustomerEntitlement : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional order identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier for the order.")] + public string OrderId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(OrderId)) + { + GetEntitlements(CustomerId); + } + else + { + GetEntitlements(CustomerId, OrderId); + } + } + + /// + /// Gets a list of entitlements from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the order. + /// + /// is empty or null. + /// + private void GetEntitlements(string customerId, string orderId) + { + IEnumerable entitlements; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + entitlements = Partner.Customers[customerId].Entitlements.Get().Items.Where(e => e.ReferenceOrder.Id == orderId); + + WriteObject(entitlements.Select(e => new PSEntitlement(e)), true); + } + finally + { + entitlements = null; + } + } + + /// + /// Gets a list of customers from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private void GetEntitlements(string customerId) + { + IEnumerable entitlements; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + entitlements = Partner.Customers[customerId].Entitlements.Get().Items; + + WriteObject(entitlements.Select(e => new PSEntitlement(e)), true); + } + finally + { + entitlements = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerLicense.cs b/src/PowerShell/Commands/GetPartnerCustomerLicense.cs new file mode 100644 index 0000000..a79e51b --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerLicense.cs @@ -0,0 +1,122 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models.Licenses; + using PartnerCenter.Models; + using PartnerCenter.Models.Licenses; + + [Cmdlet(VerbsCommon.Get, "PartnerCustomerLicense", DefaultParameterSetName = "ByCustomerId"), OutputType(typeof(PSSubscribedSku))] + public class GetPartnerCustomerLicense : PartnerPSCmdlet + { + /// + /// Gets or sets the customer identifier. + /// + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = true, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the user identifier. + /// + [Parameter(ParameterSetName = "ByUserId", Mandatory = false, HelpMessage = "The identifier for the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the license group identifier. + /// + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = false, HelpMessage = "The identifier for the license group.")] + public LicenseGroupId? LicenseGroupId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(UserId)) + { + GetUserLicenses(CustomerId, UserId); + } + else + { + GetSubscribedSkus(CustomerId, LicenseGroupId); + } + } + + /// + /// Gets a list of available licenses. + /// + /// Identifier of the customer. + /// Identifier of the license group. + /// + /// is empty or null. + /// + private void GetSubscribedSkus(string customerId, LicenseGroupId? groupId) + { + ResourceCollection skus; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + if (groupId.HasValue) + { + skus = Partner.Customers.ById(customerId).SubscribedSkus.Get(new List() { groupId.Value }); + } + else + { + // this is not easily mocked, because it uses an optional parameter. + skus = Partner.Customers.ById(customerId).SubscribedSkus.Get(null); + } + + if (skus.TotalCount > 0) + WriteObject(skus.Items.Select(s => new PSSubscribedSku(s)), true); + } + finally + { + skus = null; + } + } + + /// + /// Gets a list of licenses assigned to a user. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetUserLicenses(string customerId, string userId) + { + ResourceCollection licenses; + + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + + try + { + licenses = Partner.Customers.ById(CustomerId).Users.ById(userId).Licenses.Get(null); + + if (licenses.TotalCount > 0) + WriteObject(licenses.Items.Select(l => new PSLicense(l)), true); + } + finally + { + licenses = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerLicenseDeploymentInfo.cs b/src/PowerShell/Commands/GetPartnerCustomerLicenseDeploymentInfo.cs new file mode 100644 index 0000000..f2bff38 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerLicenseDeploymentInfo.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Analytics; + using PartnerCenter.Models; + using PartnerCenter.Models.Analytics; + + [Cmdlet(VerbsCommon.Get, "PartnerCustomerLicenseDeploymentInfo"), OutputType(typeof(PSCustomerLicensesDeploymentInsights))] + public class GetPartnerCustomerLicenseDeploymentInfo : PartnerPSCmdlet + { + /// + /// Gets or sets the customer identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection insights; + + try + { + insights = Partner.Customers[CustomerId].Analytics.Licenses.Deployment.Get(); + + WriteObject(insights.Items.Select(i => new PSCustomerLicensesDeploymentInsights(i)), true); + } + finally + { + insights = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerManagedService.cs b/src/PowerShell/Commands/GetPartnerCustomerManagedService.cs new file mode 100644 index 0000000..dd2ea26 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerManagedService.cs @@ -0,0 +1,112 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.ManagedServices; + using PartnerCenter.PowerShell.Models.ManagedServices; + + /// + /// Gets the customer's managed services from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerManagedService"), OutputType(typeof(PSManagedService))] + public class GetPartnerCustomerManagedService : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the managed service identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "A string that identifies the managed service.")] + [ValidateNotNullOrEmpty] + public string ManagedServiceId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(ManagedServiceId)) + { + GetManagedService(CustomerId, ManagedServiceId); + } + else + { + GetManagedServices(CustomerId); + } + } + + /// + /// Gets the managed services for the customer. + /// + /// Identifier for the customer. + /// + /// is empty or null. + /// + private void GetManagedServices(string customerId) + { + ResourceCollection managedServices; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + managedServices = Partner.Customers.ById(CustomerId).ManagedServices.Get(); + + if (managedServices.TotalCount > 0) + { + WriteObject(managedServices.Items.Select(s => new PSManagedService(s)), true); + } + } + finally + { + managedServices = null; + } + } + + /// + /// Gets a specific managed service for a customer. + /// + /// The idnentifier for the customer. + /// The identifier of the managed service. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetManagedService(string customerId, string managedServiceId) + { + ResourceCollection managedServices; + + customerId.AssertNotEmpty(nameof(customerId)); + managedServiceId.AssertNotEmpty(nameof(managedServiceId)); + + try + { + managedServices = Partner.Customers.ById(CustomerId).ManagedServices.Get(); + + if (managedServices.TotalCount > 0) + { + WriteObject(managedServices.Items.Where(s => s.Id == managedServiceId).Select(i => new PSManagedService(i)), true); + } + } + finally + { + managedServices = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerOrder.cs b/src/PowerShell/Commands/GetPartnerCustomerOrder.cs new file mode 100644 index 0000000..f1d855d --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerOrder.cs @@ -0,0 +1,127 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using PartnerCenter.Models.Offers; + using PartnerCenter.Models.Orders; + using PartnerCenter.PowerShell.Models.Orders; + + /// + /// Get a customer, or a list of customers, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerOrder"), OutputType(typeof(PSOrder))] + public class GetPartnerCustomerOrder : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = true, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByOrderId", Mandatory = true, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByBillingCycle", Mandatory = true, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional order identifier. + /// + /// + /// If this parameter is not specified then a list of orders will be returned. + /// When it is specified then the order associated with the identifier will be returned. + /// + [Parameter(ParameterSetName = "ByOrderId", Mandatory = true, HelpMessage = "The identifier for the order.")] + public string OrderId { get; set; } + + /// + /// Gets or sets the optional cilling cycle identifier. + /// + [Parameter(ParameterSetName = "ByBillingCycle", Mandatory = true, HelpMessage = "Indicates the type of billing cycle.")] + [ValidateSet(nameof(BillingCycleType.Annual), nameof(BillingCycleType.Monthly), nameof(BillingCycleType.None), nameof(BillingCycleType.OneTime), nameof(BillingCycleType.Unknown))] + public BillingCycleType? BillingCycle { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(OrderId)) + { + GetCustomerOrders(CustomerId, BillingCycle); + } + else + { + GetCustomerOrder(CustomerId, OrderId); + } + } + + /// + /// Gets the specified customer order from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the order. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetCustomerOrder(string customerId, string orderId) + { + Order order; + + customerId.AssertNotEmpty(nameof(customerId)); + orderId.AssertNotEmpty(nameof(orderId)); + + try + { + order = Partner.Customers.ById(customerId).Orders.ById(orderId).Get(); + + WriteObject(new PSOrder(order)); + } + finally + { + order = null; + } + } + + /// + /// Gets a list of customer orders from Partner Center. + /// + /// Identifier of the customer. + /// BillingCycle identifier. + /// + /// is empty or null. + /// + private void GetCustomerOrders(string customerId, BillingCycleType? billingCycle) + { + IEnumerable orders; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + if (billingCycle.HasValue) + { + orders = Partner.Customers.ById(customerId).Orders.ByBillingCycleType(billingCycle.Value).Get().Items; + } + else + { + orders = Partner.Customers.ById(customerId).Orders.Get().Items; + } + + WriteObject(orders.Select(o => new PSOrder(o)), true); + } + finally + { + orders = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerSubscription.cs b/src/PowerShell/Commands/GetPartnerCustomerSubscription.cs new file mode 100644 index 0000000..73e06ae --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerSubscription.cs @@ -0,0 +1,106 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.Subscriptions; + using PartnerCenter.PowerShell.Models.Customers; + using PartnerCenter.PowerShell.Models.Subscriptions; + + [Cmdlet(VerbsCommon.Get, "PartnerCustomerSubscription", DefaultParameterSetName = "Customer"), OutputType(typeof(PSSubscription))] + public class GetPartnerCustomerSubscription : PartnerPSCmdlet + { + /// + /// Gets or sets the customer object used to scope the request. + /// + [Parameter(HelpMessage = "The customer object.", ParameterSetName = "CustomerObject", Mandatory = true, ValueFromPipeline = true)] + [ValidateNotNull] + public PSCustomer InputObject { get; set; } + + /// + /// Gets or sets the customer identifier. + /// + [Parameter(HelpMessage = "The identifier of the customer.", ParameterSetName = "Customer", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the subscriptions identifier. + /// + [Parameter(HelpMessage = "The identifier of the subscription.", ParameterSetName = "Customer", Mandatory = false)] + [Parameter(HelpMessage = "The identifier of the subscription.", ParameterSetName = "CustomerObject", Mandatory = false)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(SubscriptionId)) + { + GetSubscriptions(); + } + else + { + GetSubscription(SubscriptionId); + } + } + + /// + /// Gets a specified subscription associated with the customer. + /// + /// The identifier of the subscription. + /// + /// is empty or null. + /// + public void GetSubscription(string subscriptionId) + { + Subscription subscription; + string customerId; + + subscriptionId.AssertNotEmpty(nameof(subscriptionId)); + + try + { + customerId = (InputObject == null) ? CustomerId : InputObject.CustomerId; + subscription = Partner.Customers[customerId].Subscriptions[subscriptionId].Get(); + + WriteObject(new PSSubscription(subscription)); + } + finally + { + subscription = null; + } + } + + /// + /// Gets a list of subscription of subscriptions associated with the customer. + /// + private void GetSubscriptions() + { + ResourceCollection subscriptions; + string customerId; + + try + { + customerId = (InputObject == null) ? CustomerId : InputObject.CustomerId; + subscriptions = Partner.Customers[customerId].Subscriptions.Get(); + + WriteObject(subscriptions.Items.Select(s => new PSSubscription(s)), true); + } + finally + { + subscriptions = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerSubscriptionProvisioningStatus.cs b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionProvisioningStatus.cs new file mode 100644 index 0000000..db222b8 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionProvisioningStatus.cs @@ -0,0 +1,53 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Subscriptions; + using PartnerCenter.Models.Subscriptions; + + /// + /// Retrieves the provisioning status for the specified subscription. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerSubscriptionProvisioningStatus"), OutputType(typeof(PSSubscriptionProvisioningStatus))] + public class GetPartnerCustomerSubscriptionProvisioningStatus : PartnerPSCmdlet + { + /// + /// Gets or sets the identifier of the customer. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the offer category. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the subscription.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + SubscriptionProvisioningStatus status; + + try + { + status = Partner.Customers[CustomerId].Subscriptions[SubscriptionId].ProvisioningStatus.Get(); + + WriteObject(new PSSubscriptionProvisioningStatus(status)); + } + finally + { + status = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerSubscriptionRegistrationStatus.cs b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionRegistrationStatus.cs new file mode 100644 index 0000000..4583e83 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionRegistrationStatus.cs @@ -0,0 +1,53 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Subscriptions; + using PartnerCenter.Models.Subscriptions; + + /// + /// Retrieves the registration status for the specified subscription. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerSubscriptionRegistrationStatus"), OutputType(typeof(PSSubscriptionRegistrationStatus))] + public class GetPartnerCustomerSubscriptionRegistrationStatus : PartnerPSCmdlet + { + /// + /// Gets or sets the identifier of the customer. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the offer category. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the subscription.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + SubscriptionRegistrationStatus status; + + try + { + status = Partner.Customers[CustomerId].Subscriptions[SubscriptionId].RegistrationStatus.Get(); + + WriteObject(new PSSubscriptionRegistrationStatus(status)); + } + finally + { + status = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUpgrades.cs b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUpgrades.cs new file mode 100644 index 0000000..368049b --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUpgrades.cs @@ -0,0 +1,54 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.CustomerSubscriptionUpgrades; + using PartnerCenter.Models; + using PartnerCenter.Models.Subscriptions; + + /// + /// Gets the available upgrade offers for the specified subscription. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerSubscriptionUpgrades"), OutputType(typeof(PSCustomerSubscriptionUpgrades))] + public class GetCustomerSubscriptionUpgrades : PartnerPSCmdlet + { + /// + /// Gets or sets the identifier of the customer. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the identifier of the subscription. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the subscription.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection upgrades; + + try + { + upgrades = Partner.Customers.ById(CustomerId).Subscriptions.ById(SubscriptionId).Upgrades.Get(); + WriteObject(upgrades.Items.Select(c => new PSCustomerSubscriptionUpgrades(c)), true); + } + finally + { + upgrades = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUtilization.cs b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUtilization.cs new file mode 100644 index 0000000..f114dbf --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUtilization.cs @@ -0,0 +1,110 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Enumerators; + using Models.Utilizations; + using PartnerCenter.Models; + using PartnerCenter.Models.Utilizations; + + /// + /// Cmdlet used to obtain Azure utilization records for the specified subscription. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerSubscriptionUtilization"), OutputType(typeof(PSAzureUtilizationRecord))] + public class GetPartnerCustomerSubscriptionUtilization : PartnerPSCmdlet + { + /// + /// Gets or sets the identifier of the customer that owns the subscription. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the end date (in UTC) of the usages to filter. + /// + [Parameter(HelpMessage = "The end date (in UTC) of the usages to filter.", Mandatory = false)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public DateTimeOffset? EndDate { get; set; } + + /// + /// Gets or sets the resource usage time granularity. Can either be daily or hourly. The default value is daily. + /// + [Parameter(HelpMessage = "The resource usage time granularity. Can either be daily or hourly. The default value is daily", Mandatory = false)] + [ValidateNotNull] + public AzureUtilizationGranularity? Granularity { get; set; } + + /// + /// Gets or sets a flag indicating whether or not utilization records will be aggregated on the resource level. + /// + /// + /// If set to true, the utilization records will be split by the resource instance + /// levels. If set to false, the utilization records will be aggregated on the resource level. + /// + [Parameter(HelpMessage = "A flag that incicates whether or not utilization records will be aggregated on the resource level.", Mandatory = true)] + [ValidateNotNull] + public SwitchParameter ShowDetails { get; set; } + + /// + /// Gets or sets the start date (in UTC) of the usages to filter. + /// + [Parameter(HelpMessage = "The start date (in UTC) of the usages to filter.", Mandatory = true)] + [ValidateNotNull] + public DateTimeOffset StartDate { get; set; } + + /// + /// Gets or sets the identifier of the Azure subscription. + /// + [Parameter(HelpMessage = "The identifier of the subscription.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + IResourceCollectionEnumerator> enumerator; + List records; + ResourceCollection utilizationRecords; + + try + { + utilizationRecords = Partner.Customers[CustomerId] + .Subscriptions[SubscriptionId] + .Utilization.Azure.Query( + StartDate, + EndDate ?? DateTimeOffset.Now, + Granularity ?? AzureUtilizationGranularity.Daily, + (!ShowDetails.IsPresent) || ShowDetails.ToBool()); + + enumerator = Partner.Enumerators.Utilization.Azure.Create(utilizationRecords); + + records = new List(); + + while (enumerator.HasValue) + { + records.AddRange(enumerator.Current.Items.Select(r => new PSAzureUtilizationRecord(r))); + enumerator.Next(); + } + + WriteObject(records, true); + } + finally + { + enumerator = null; + records = null; + utilizationRecords = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerTrialConversion.cs b/src/PowerShell/Commands/GetPartnerCustomerTrialConversion.cs new file mode 100644 index 0000000..bd9223b --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerTrialConversion.cs @@ -0,0 +1,51 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.CustomerTrialConversion; + using PartnerCenter.Models; + using PartnerCenter.Models.Subscriptions; + + [Cmdlet(VerbsCommon.Get, "PartnerCustomerTrialConversion"), OutputType(typeof(PSCustomerTrialConversion))] + public class GetPartnerTrialConversion : PartnerPSCmdlet + { + /// + /// Gets or sets the customer identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the subscription.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection conversions; + + try + { + conversions = Partner.Customers.ById(CustomerId).Subscriptions.ById(SubscriptionId).Conversions.Get(); + WriteObject(conversions.Items.Select(c => new PSCustomerTrialConversion(c)), true); + } + finally + { + conversions = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerUser.cs b/src/PowerShell/Commands/GetPartnerCustomerUser.cs new file mode 100644 index 0000000..522ad14 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerUser.cs @@ -0,0 +1,221 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Exceptions; + using Models.CustomerUsers; + using PartnerCenter.Enumerators; + using PartnerCenter.Models; + using PartnerCenter.Models.Query; + using PartnerCenter.Models.Users; + + /// + /// Gets a list of users for a customer from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerUser", DefaultParameterSetName = "ByCustomerId"), OutputType(typeof(PSCustomerUser))] + public class GetPartnerCustomerUser : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByUpn", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional user identifier. + /// + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, HelpMessage = "The identifier for the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the optional user principal name. + /// + [Parameter(ParameterSetName = "ByUpn", Mandatory = true, HelpMessage = "The user principal name (UPN) for the user.")] + [ValidateNotNullOrEmpty] + public string UserPrincipalName { get; set; } + + /// + /// Gets or sets the optional user identifier. + /// + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = false, HelpMessage = "A flag that indicates whether or not to show deleted users.")] + [ValidateNotNullOrEmpty] + public SwitchParameter ReturnDeletedUsers { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + switch (ParameterSetName) + { + case "ByCustomerId": + if (ReturnDeletedUsers) + { + List users = GetDeletedUsers(CustomerId); + WriteObject(users.Select(u => new PSCustomerUser(u)), true); + } + else + { + List users = GetUsers(CustomerId); + WriteObject(users.Select(u => new PSCustomerUser(u)), true); + } + + break; + case "ByUpn": + GetUserByUpn(CustomerId, UserPrincipalName); + break; + case "ByUserId": + GetUserById(CustomerId, UserId); + break; + } + } + + /// + /// Gets a details for a specified user and customer from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// + private void GetUserById(string customerId, string userId) + { + CustomerUser user; + + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + + try + { + user = Partner.Customers[customerId].Users[userId].Get(); + WriteObject(new PSCustomerUser(user)); + } + catch (PSPartnerException ex) + { + throw new PSPartnerException("Error finding user:" + userId, ex); + } + finally + { + user = null; + } + } + + /// + /// Gets a list of users from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private List GetUsers(string customerId) + { + IResourceCollectionEnumerator> usersEnumerator; + List users; + SeekBasedResourceCollection seekUsers; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + users = new List(); + + seekUsers = Partner.Customers[customerId].Users.Get(); + usersEnumerator = Partner.Enumerators.CustomerUsers.Create(seekUsers); + + while (usersEnumerator.HasValue) + { + users.AddRange(usersEnumerator.Current.Items); + usersEnumerator.Next(); + } + + return users; + } + finally + { + seekUsers = null; + usersEnumerator = null; + } + } + + /// + /// Gets a list of deleted users from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private List GetDeletedUsers(string customerId) + { + SimpleFieldFilter filter = new SimpleFieldFilter("UserState", FieldFilterOperation.Equals, "Inactive"); + IQuery simpleQueryWithFilter = QueryFactory.Instance.BuildSimpleQuery(filter); + IResourceCollectionEnumerator> usersEnumerator; + List users; + SeekBasedResourceCollection seekUsers; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + users = new List(); + + seekUsers = Partner.Customers[customerId].Users.Query(simpleQueryWithFilter); + usersEnumerator = Partner.Enumerators.CustomerUsers.Create(seekUsers); + while (usersEnumerator.HasValue) + { + users.AddRange(usersEnumerator.Current.Items); + usersEnumerator.Next(); + } + + return users; + } + finally + { + users = null; + seekUsers = null; + usersEnumerator = null; + } + } + + /// + /// Gets a list of users by searching for the user principal name from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user principal name. + /// + /// is empty or null. + /// + private void GetUserByUpn(string customerId, string userPrincipalName) + { + + customerId.AssertNotEmpty(nameof(customerId)); + customerId.AssertNotEmpty(nameof(userPrincipalName)); + + List gUsers = GetUsers(customerId); + try + { + CustomerUser fUser = gUsers.Where(u => string.Equals(u.UserPrincipalName, userPrincipalName, StringComparison.CurrentCultureIgnoreCase)).First(); + WriteObject(new PSCustomerUser(fUser)); + } + catch + { + throw new PSPartnerException("Error finding user id for " + userPrincipalName); + } + + } + + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerCustomerUserRole.cs b/src/PowerShell/Commands/GetPartnerCustomerUserRole.cs new file mode 100644 index 0000000..0efb2d6 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerCustomerUserRole.cs @@ -0,0 +1,104 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models.DirectoryRoles; + using PartnerCenter.Models.Roles; + + /// + /// Gets a list of roles for the specified customer user from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerCustomerUserRole"), OutputType(typeof(PSDirectoryRole))] + public class GetPartnerCustomerUserRole : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional user identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier for the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(UserId)) + { + GetRole(CustomerId); + } + else + { + GetRole(CustomerId, UserId); + } + } + + /// + /// Gets a list of roles from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetRole(string customerId, string userId) + { + IEnumerable roles; + + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + + try + { + roles = Partner.Customers[customerId].Users[userId].DirectoryRoles.Get().Items; + WriteObject(roles.Select(e => new PSDirectoryRole(e)), true); + } + finally + { + roles = null; + } + } + + /// + /// Gets a list of customers from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private void GetRole(string customerId) + { + IEnumerable roles; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + roles = Partner.Customers[customerId].DirectoryRoles.Get().Items; + WriteObject(roles.Select(e => new PSDirectoryRole(e)), true); + } + finally + { + roles = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerIndirectReseller.cs b/src/PowerShell/Commands/GetPartnerIndirectReseller.cs new file mode 100644 index 0000000..874d850 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerIndirectReseller.cs @@ -0,0 +1,40 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using Models.Relationships; + using PartnerCenter.Models; + using PartnerCenter.Models.Relationships; + + /// + /// Gets a list of indirect resellers from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerIndirectReseller"), OutputType(typeof(PSPartnerRelationship))] + public class GetPartnerIndirectReseller : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection resellers; + + try + { + resellers = Partner.Relationships.Get(PartnerRelationshipType.IsIndirectCloudSolutionProviderOf); + + WriteObject(resellers.Items.Select(r => new PSPartnerRelationship(r)), true); + } + finally + { + resellers = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerInvoice.cs b/src/PowerShell/Commands/GetPartnerInvoice.cs new file mode 100644 index 0000000..62f57d4 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerInvoice.cs @@ -0,0 +1,93 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Common; + using Enumerators; + using PartnerCenter.Models; + using PartnerCenter.Models.Invoices; + using PartnerCenter.PowerShell.Models.Invoices; + + /// + /// Gets a list of invoices from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerInvoice"), OutputType(typeof(PSInvoice))] + public class GetPartnerInvoice : PartnerPSCmdlet + { + /// + /// Gets or sets the invoice identifier. + /// + [Parameter(HelpMessage = "The identifier for the invoice.", Mandatory = false)] + [ValidateNotNull] + public string InvoiceId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(InvoiceId)) + { + GetInvoices(); + } + else + { + GetInvoice(InvoiceId); + } + } + + private void GetInvoice(string invoiceId) + { + Invoice invoice; + + invoiceId.AssertNotEmpty(invoiceId); + + try + { + invoice = Partner.Invoices[invoiceId].Get(); + + WriteObject(new PSInvoice(invoice)); + } + finally + { + invoice = null; + } + } + + private void GetInvoices() + { + IResourceCollectionEnumerator> enumerator; + List invoices; + ResourceCollection resources; + + try + { + resources = Partner.Invoices.Get(); + enumerator = Partner.Enumerators.Invoices.Create(resources); + + invoices = new List(); + + while (enumerator.HasValue) + { + invoices.AddRange(enumerator.Current.Items.Select(i => new PSInvoice(i))); + enumerator.Next(); + } + + WriteObject(invoices, true); + } + finally + { + enumerator = null; + invoices = null; + resources = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerInvoiceStatement.cs b/src/PowerShell/Commands/GetPartnerInvoiceStatement.cs new file mode 100644 index 0000000..66b46b8 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerInvoiceStatement.cs @@ -0,0 +1,95 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.IO; + using System.Management.Automation; + + /// + /// Get partner licenses usage information aggregated to include all customers from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerInvoiceStatement")] + public class GetPartnerInvoiceStatement : PartnerPSCmdlet + { + /// + /// The invoice id of the statement to retrieve. + /// + [Parameter(Mandatory = true, HelpMessage = "The indentifier of the invoice.")] + [ValidateNotNullOrEmpty] + public string InvoiceId { get; set; } + + /// + /// The output path of the PDF statement file. + /// + [Parameter(Mandatory = false, HelpMessage = "The output path of the PDF statement file.")] + [ValidateNotNullOrEmpty] + public string OutputPath { get; set; } + + /// + /// Gets or sets a flag indiciating whether or to overwrite the file if it exists. + /// + [Parameter(Mandatory = false, HelpMessage = "A flag indiciating whether or not to overwrite the file if it exists.")] + [ValidateNotNull] + public SwitchParameter Overwrite { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (string.IsNullOrEmpty(OutputPath)) + { + OutputPath = Directory.GetCurrentDirectory(); + } + + DirectoryInfo dirInfo = Directory.CreateDirectory(OutputPath); + string filePath = ""; + + if (dirInfo.FullName.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.CurrentCulture), System.StringComparison.CurrentCulture)) + { + filePath = dirInfo.FullName + InvoiceId + ".pdf"; + } + else + { + filePath = dirInfo.FullName + Path.DirectorySeparatorChar.ToString(CultureInfo.CurrentCulture) + InvoiceId + ".pdf"; + } + + if (File.Exists(filePath)) + { + if (!Overwrite.IsPresent) + throw new PSInvalidOperationException("The path already exists: " + filePath + ". Specify the -Overwrite switch to overwrite the file"); + } + + GetStatement(InvoiceId, filePath); + } + + /// + /// Gets the specified invoice statement for the specified invoiceId and outputs the PDF file to outputPath + /// + private void GetStatement(string invoiceId, string filePath) + { + Stream stream; + FileStream file; + + try + { + stream = Partner.Invoices.ById(invoiceId).Documents.Statement.Get(); + file = File.Create(filePath); + stream.Seek(0, SeekOrigin.Begin); + stream.CopyTo(file); + file.Close(); + stream.Close(); + } + finally + { + stream = null; + file = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerInvoiceSummary.cs b/src/PowerShell/Commands/GetPartnerInvoiceSummary.cs new file mode 100644 index 0000000..4e14e1d --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerInvoiceSummary.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using PartnerCenter.Models; + using PartnerCenter.Models.Invoices; + using PartnerCenter.PowerShell.Models.Invoices; + + [Cmdlet(VerbsCommon.Get, "PartnerInvoiceSummary"), OutputType(typeof(PSInvoiceSummary))] + public class GetPartnerInvoiceSummary : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection summaries; + + try + { + summaries = Partner.Invoices.Summaries.Get(); + + WriteObject(summaries.Items.Select(s => new PSInvoiceSummary(s)), true); + } + finally + { + summaries = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerLegalProfile.cs b/src/PowerShell/Commands/GetPartnerLegalProfile.cs new file mode 100644 index 0000000..abfd5bd --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerLegalProfile.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.Partners; + using PartnerCenter.Models.Partners; + + /// + /// Gets the partner organization profile from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerLegalProfile"), OutputType(typeof(PSLegalBusinessProfile))] + public class GetPartnerLegalProfile : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + LegalBusinessProfile profile; + + try + { + profile = Partner.Profiles.LegalBusinessProfile.Get(); + + WriteObject(new PSLegalBusinessProfile(profile)); + } + finally + { + profile = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerLicenseDeploymentInfo.cs b/src/PowerShell/Commands/GetPartnerLicenseDeploymentInfo.cs new file mode 100644 index 0000000..4cc22d4 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerLicenseDeploymentInfo.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Models.Analytics; + using PartnerCenter.Models.Analytics; + + /// + /// Get partner licenses deployment information aggregated to include all customers from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerLicenseDeploymentInfo"), OutputType(typeof(PSPartnerLicensesDeploymentInsight))] + public class GetPartnerLicenseDeploymentInfo : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() { GetLicenseDeploymentInfo(); } + + /// + /// Get partner licenses deployment information aggregated to include all customers from Partner Center.. + /// + private void GetLicenseDeploymentInfo() + { + IEnumerable insights; + + try + { + insights = Partner.Analytics.Licenses.Deployment.Get().Items; + + WriteObject(insights.Select(l => new PSPartnerLicensesDeploymentInsight(l)), true); + } + finally + { + insights = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerLicenseUsageInfo.cs b/src/PowerShell/Commands/GetPartnerLicenseUsageInfo.cs new file mode 100644 index 0000000..42b1ce7 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerLicenseUsageInfo.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Models.Analytics; + using PartnerCenter.Models.Analytics; + + /// + /// Get partner licenses usage information aggregated to include all customers from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerLicenseUsageInfo"), OutputType(typeof(PSPartnerLicensesUsageInsight))] + public class GetPartnerLicenseUsageInfo : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() { GetLicenseUsageInfo(); } + + /// + /// Get partner licenses usage information aggregated to include all customers from Partner Center.. + /// + private void GetLicenseUsageInfo() + { + IEnumerable insights; + + try + { + insights = Partner.Analytics.Licenses.Usage.Get().Items; + + WriteObject(insights.Select(l => new PSPartnerLicensesUsageInsight(l)), true); + } + finally + { + insights = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerOffer.cs b/src/PowerShell/Commands/GetPartnerOffer.cs new file mode 100644 index 0000000..15c90f9 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerOffer.cs @@ -0,0 +1,166 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Authentication; + using Common; + using Models.Offers; + using PartnerCenter.Models; + using PartnerCenter.Models.Offers; + + /// + /// Get an offer, or a list offers, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerOffer"), OutputType(typeof(PSOffer))] + public class GetPartnerOffer : PartnerPSCmdlet + { + /// + /// Gets or sets the switch indicating whether or not to scope the results to add-ons. + /// + [Parameter(Mandatory = false, HelpMessage = "Scope returned offers to only add-ons.")] + public SwitchParameter AddOn { get; set; } + + /// + /// Gets or sets the offer category. + /// + [Parameter(Mandatory = false, HelpMessage = "Category that corresponds to the offers.")] + public string Category { get; set; } + + /// + /// Gets or sets the country code used to obtain offers. + /// + [Parameter(Mandatory = false, HelpMessage = "The country ISO2 code.")] + public string CountryCode { get; set; } + + /// + /// Gets or sets the offer identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "A GUID that corresponds to the offer.")] + public string OfferId { get; set; } + + /// + /// Gets or sets the switch indicating whether or not to scope the results to trials. + /// + [Parameter(Mandatory = false, HelpMessage = "Scope returned offers to only trials.")] + public SwitchParameter Trial { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + string countryCode = (string.IsNullOrEmpty(CountryCode)) ? PartnerProfile.Instance.Context.CountryCode : CountryCode; + + if (!string.IsNullOrEmpty(Category) && string.IsNullOrEmpty(OfferId)) + { + GetOffersByCategory(countryCode, Category); + } + else if (string.IsNullOrEmpty(OfferId)) + { + GetOffers(countryCode); + } + else + { + GetOffer(countryCode, OfferId); + } + } + + /// + /// Gets the specified offer. + /// + /// The country used to obtain the offer. + /// Identifier for the offer. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetOffer(string countryCode, string offerId) + { + Offer offer; + + countryCode.AssertNotEmpty(nameof(countryCode)); + offerId.AssertNotEmpty(nameof(offerId)); + + try + { + offer = Partner.Offers.ByCountry(countryCode).ById(offerId).Get(); + WriteObject(new PSOffer(offer)); + } + finally + { + offer = null; + } + } + + /// + /// Gets a list of offers available for the specified country. + /// + /// The country used to obtain the offers. + /// + /// is empty or null. + /// + private void GetOffers(string countryCode) + { + ResourceCollection offers; + + countryCode.AssertNotEmpty(nameof(countryCode)); + + try + { + offers = Partner.Offers.ByCountry(countryCode).Get(); + WriteOutput(offers.Items); + } + finally + { + offers = null; + } + } + + /// + /// Gets a list of offers by country and category. + /// + /// The country used to obtain the offers. + /// The category for the offers. + private void GetOffersByCategory(string countryCode, string category) + { + ResourceCollection offers; + + countryCode.AssertNotEmpty(nameof(countryCode)); + category.AssertNotEmpty(nameof(category)); + + try + { + offers = Partner.Offers.ByCountry(countryCode).ByCategory(category).Get(); + WriteOutput(offers.Items); + } + finally + { + offers = null; + } + } + + /// + /// Helper method to write a list of offers. + /// + /// List of offers to be written to the output. + private void WriteOutput(IEnumerable offers) + { + bool isAddOn = AddOn.IsPresent && AddOn.ToBool(); + bool isTrial = Trial.IsPresent && Trial.ToBool(); + + WriteObject( + offers + .Where(o => o.IsAddOn == isAddOn && o.IsTrial == isTrial) + .Select(o => new PSOffer(o)) + .ToList()); + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerOfferAddon.cs b/src/PowerShell/Commands/GetPartnerOfferAddon.cs new file mode 100644 index 0000000..61dd38f --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerOfferAddon.cs @@ -0,0 +1,54 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using Authentication; + using Models.Offers; + using PartnerCenter.Models; + using PartnerCenter.Models.Offers; + + [Cmdlet(VerbsCommon.Get, "PartnerOfferAddon"), OutputType(typeof(PSOffer))] + public class GetPartnerOfferAddon : PartnerPSCmdlet + { + /// + /// Gets or sets the country code. + /// + [Parameter(Mandatory = false, HelpMessage = "The country code in ISO2 format.")] + [ValidateNotNullOrEmpty] + public string CountryCode { get; set; } + + /// + /// Gets or sets the offer identifier. + /// + + [Parameter(Mandatory = true, Position = 0, HelpMessage = "The identifier of the offer.")] + [ValidateNotNullOrEmpty] + public string OfferId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection offers; + string countryCode = (string.IsNullOrEmpty(CountryCode)) ? PartnerProfile.Instance.Context.CountryCode : CountryCode; + + try + { + offers = Partner.Offers.ByCountry(countryCode).ById(OfferId).AddOns.Get(); + + WriteObject(offers.Items.Select(o => new PSOffer(o)), true); + } + finally + { + offers = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerOrganizationProfile.cs b/src/PowerShell/Commands/GetPartnerOrganizationProfile.cs new file mode 100644 index 0000000..ce564c1 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerOrganizationProfile.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.Partners; + using PartnerCenter.Models.Partners; + + /// + /// Gets the partner organization profile from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerOrganizationProfile"), OutputType(typeof(PSOrganizationProfile))] + public class GetPartnerOrganizationProfile : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + OrganizationProfile profile; + + try + { + profile = Partner.Profiles.OrganizationProfile.Get(); + + WriteObject(new PSOrganizationProfile(profile)); + } + finally + { + profile = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerProduct.cs b/src/PowerShell/Commands/GetPartnerProduct.cs new file mode 100644 index 0000000..4b29a86 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerProduct.cs @@ -0,0 +1,183 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using Authentication; + using Common; + using Exceptions; + using Models.Products; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Products; + + /// + /// Get a product, or a list products, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerProduct", DefaultParameterSetName = "ByCatalog"), OutputType(typeof(PSProduct))] + public class GetPartnerProduct : PartnerPSCmdlet + { + /// + /// Gets or sets the country code used to obtain products. + /// + [Parameter(ParameterSetName = "ByProductId", Mandatory = false, HelpMessage = "The country ISO2 code.")] + [Parameter(ParameterSetName = "ByCatalog", Mandatory = false, HelpMessage = "The country ISO2 code.")] + public string CountryCode { get; set; } + + /// + /// Gets or sets the product identifier. + /// + [Parameter(ParameterSetName = "ByProductId", Mandatory = true, HelpMessage = "A string that identifies the product.")] + public string ProductId { get; set; } + + /// + /// Gets or sets the product catalog. + /// + [Parameter(ParameterSetName = "ByCatalog", Mandatory = true, HelpMessage = "A string that the product catalog.")] + [ValidateSet("Azure", "OnlineServices", "Software")] + public string Catalog { get; set; } + + /// + /// Gets or sets the product segment. + /// + [Parameter(ParameterSetName = "ByCatalog", Mandatory = false, HelpMessage = "A string that the product segment.")] + [ValidateSet("commercial", "education", "government", "nonprofit")] + public string Segment { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + string countryCode = string.IsNullOrEmpty(CountryCode) ? PartnerProfile.Instance.Context.CountryCode : CountryCode; + + if (!string.IsNullOrEmpty(ProductId)) + { + GetProduct(countryCode, ProductId); + } + else if (!string.IsNullOrEmpty(Catalog)) + { + if (!string.IsNullOrEmpty(Segment)) + { + GetProductsBySegment(countryCode, Catalog, Segment); + } + else + { + GetProductsByCatalog(countryCode, Catalog); + } + } + else + { + throw new PSInvalidOperationException("You must specify a ProductId or Catalog."); + } + } + + /// + /// Gets the specified product. + /// + /// The country used to obtain the offer. + /// Identifier for the product. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetProduct(string countryCode, string productId) + { + Product product; + + countryCode.AssertNotEmpty(nameof(countryCode)); + productId.AssertNotEmpty(nameof(productId)); + + try + { + product = Partner.Products.ByCountry(countryCode).ById(productId).Get(); + if (product != null) + WriteObject(new PSProduct(product)); + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting product id: " + productId, ex); + } + finally + { + product = null; + } + } + + /// + /// Gets a list of products by country and category. + /// + /// The country used to obtain the offers. + /// Identifies the target view of the catalog. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetProductsByCatalog(string countryCode, string targetView) + { + ResourceCollection products; + + countryCode.AssertNotEmpty(nameof(countryCode)); + targetView.AssertNotEmpty(nameof(targetView)); + + try + { + products = Partner.Products.ByCountry(countryCode).ByTargetView(targetView).Get(); + if (products.TotalCount > 0) + WriteObject(products.Items.Select(p => new PSProduct(p)), true); + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting products for catalog: " + targetView, ex); + } + finally + { + products = null; + } + } + + /// + /// Gets a list of products by country, category and segment. + /// + /// The country used to obtain the offers. + /// Identifies the target view of the catalog. + /// Identifies the target segment. + /// + /// is empty or null. + /// or + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetProductsBySegment(string countryCode, string targetView, string targetSegment) + { + ResourceCollection products; + + countryCode.AssertNotEmpty(nameof(countryCode)); + targetView.AssertNotEmpty(nameof(targetView)); + targetSegment.AssertNotEmpty(nameof(targetSegment)); + + try + { + products = Partner.Products.ByCountry(countryCode).ByTargetView(targetView).ByTargetSegment(targetSegment).Get(); + if (products.TotalCount > 0) + WriteObject(products.Items.Select(p => new PSProduct(p)), true); + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting products for segment: " + targetSegment, ex); + } + finally + { + products = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerProductAvailability.cs b/src/PowerShell/Commands/GetPartnerProductAvailability.cs new file mode 100644 index 0000000..048a995 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerProductAvailability.cs @@ -0,0 +1,152 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using Authentication; + using Exceptions; + using Models.Products; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Products; + + /// + /// Get a product, or a list products, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerProductAvailability", DefaultParameterSetName = "BySku"), OutputType(typeof(PSProductAvailability))] + public class GetPartnerProductAvailability : PartnerPSCmdlet + { + /// + /// Gets or sets the product identifier. + /// + [Parameter(ParameterSetName = "ByAvailabilityId", Mandatory = true, HelpMessage = "A string that identifies the product.")] + [Parameter(ParameterSetName = "BySku", Mandatory = true, HelpMessage = "A string that identifies the product.")] + public string ProductId { get; set; } + + /// + /// Gets or sets the product identifier. + /// + [Parameter(ParameterSetName = "ByAvailabilityId", Mandatory = true, HelpMessage = "A string that identifies the product Sku.")] + [Parameter(ParameterSetName = "BySku", Mandatory = true, HelpMessage = "A string that identifies the product Sku.")] + public string SkuId { get; set; } + + /// + /// Gets or sets the country code used to obtain product availability. + /// + [Parameter(ParameterSetName = "ByAvailabilityId", Mandatory = false, HelpMessage = "The country ISO2 code.")] + [Parameter(ParameterSetName = "BySku", Mandatory = false, HelpMessage = "The country ISO2 code.")] + public string CountryCode { get; set; } + + /// + /// Gets or sets the product catalog. + /// + [Parameter(ParameterSetName = "ByAvailabilityId", Mandatory = true, HelpMessage = "A string that identifies the availability.")] + public string AvailabilityId { get; set; } + + /// + /// Gets or sets the product segment. + /// + [Parameter(ParameterSetName = "BySku", Mandatory = false, HelpMessage = "A string that identifies the product segment.")] + [ValidateSet("commercial", "education", "government", "nonprofit")] + public string Segment { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + string countryCode = (string.IsNullOrEmpty(CountryCode)) ? PartnerProfile.Instance.Context.CountryCode : CountryCode; + + if (string.IsNullOrEmpty(AvailabilityId)) + { + if (!string.IsNullOrEmpty(Segment)) + { + GetProductAvailabilityBySku(countryCode, ProductId, SkuId); + } + else + { + GetProductAvailabilityBySku(countryCode, ProductId, SkuId, Segment); + } + } + else if (!string.IsNullOrEmpty(AvailabilityId)) + { + GetProductAvailabilityById(countryCode, ProductId, SkuId, AvailabilityId); + } + else + { + throw new PSInvalidOperationException("You must specify a ProductId or Catalog."); + } + } + + /// + /// Gets the specified product availability. + /// + /// The country used to obtain the offer. + /// Identifier for the product. + /// Identifier for the product Sku. + /// Identifier for the target segment. + private void GetProductAvailabilityBySku(string countryCode, string productId, string skuId, string segment = null) + { + ResourceCollection productAvailability; + + try + { + // If segment is specified, get the information using the segment. Otherwise don't + if (!string.IsNullOrEmpty(segment)) + { + productAvailability = Partner.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.ByTargetSegment(segment).Get(); + if (productAvailability.TotalCount > 0) + WriteObject(productAvailability.Items.Select(pa => new PSProductAvailability(pa)), true); + } + else + { + productAvailability = Partner.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.Get(); + if (productAvailability.TotalCount > 0) + WriteObject(productAvailability.Items.Select(pa => new PSProductAvailability(pa)), true); + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting product id: " + productId, ex); + } + finally + { + productAvailability = null; + } + } + + /// + /// Gets the specified product availability. + /// + /// The country used to obtain the offer. + /// Identifier for the product. + /// Identifier for the product Sku. + /// Identifier for the product availability. + private void GetProductAvailabilityById(string countryCode, string productId, string skuId, string availabilityId) + { + Availability productAvailability; + + try + { + productAvailability = Partner.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.ById(availabilityId).Get(); + if (productAvailability != null) + { + WriteObject(new PSProductAvailability(productAvailability)); + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting product id: " + productId, ex); + } + finally + { + productAvailability = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerProductInventory.cs b/src/PowerShell/Commands/GetPartnerProductInventory.cs new file mode 100644 index 0000000..cfc45a9 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerProductInventory.cs @@ -0,0 +1,114 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Authentication; + using Common; + using Exceptions; + using Models.Products; + using PartnerCenter.Exceptions; + using PartnerCenter.Models.Products; + + /// + /// Get a product, or a list products, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerProductInventory"), OutputType(typeof(PSInventoryItem))] + public class GetPartnerProductInventory : PartnerPSCmdlet + { + /// + /// Gets or sets the country code used to obtain product skus. + /// + [Parameter(Mandatory = false, HelpMessage = "The country ISO2 code.")] + public string CountryCode { get; set; } + + /// + /// Gets or sets the product identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "A string that identifies the product.")] + public string ProductId { get; set; } + + /// + /// Gets or sets the optional sku identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "A string that identifies the sku.")] + public string SkuId { get; set; } + + /// + /// Gets or sets the inventory context. + /// + /// + /// The supported values are: + /// CustomerId - The ID of the customerthat the purchase would be for. + /// AzureSubscriptionId - The ID of the Azure Subscription that would be used for an Azure Reserved VM Instance purchase. + /// + [Parameter(Mandatory = false, HelpMessage = "A hashtable of inventory variables for the product.")] + public Hashtable Variables { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ProductId.AssertNotEmpty(nameof(ProductId)); + + string countryCode = (string.IsNullOrEmpty(CountryCode)) ? PartnerProfile.Instance.Context.CountryCode : CountryCode; + + if (Variables == null) + Variables = new Hashtable(); + + GetProductInventory(countryCode, ProductId, SkuId, Variables); + } + + /// + /// Gets the specified product sku. + /// + /// The country used to obtain the offer. + /// Identifier for the product. + /// The list of variables needed to execute an inventory check on this item. + /// + /// is empty or null. + /// or + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetProductInventory(string countryCode, string productId, string skuId, Hashtable context) + { + IEnumerable item; + InventoryCheckRequest request; + + countryCode.AssertNotEmpty(nameof(countryCode)); + productId.AssertNotEmpty(nameof(productId)); + + try + { + request = new InventoryCheckRequest() + { + TargetItems = string.IsNullOrEmpty(skuId) ? new InventoryItem[] { new InventoryItem { ProductId = productId } } : new InventoryItem[] { new InventoryItem { ProductId = productId, SkuId = skuId } }, + InventoryContext = context.Cast().ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value) + }; + + item = Partner.Extensions.Product.ByCountry(countryCode).CheckInventory(request); + + WriteObject(item.Select(i => new PSInventoryItem(i)), true); + } + catch (PartnerException ex) + { + throw new PSPartnerException(null, ex); + } + finally + { + item = null; + request = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerProductSKU.cs b/src/PowerShell/Commands/GetPartnerProductSKU.cs new file mode 100644 index 0000000..c2ef674 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerProductSKU.cs @@ -0,0 +1,156 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using Authentication; + using Common; + using Exceptions; + using Models.Products; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Products; + + /// + /// Get a product, or a list products, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerProductSku", DefaultParameterSetName = "ByProductId"), OutputType(typeof(PSSku))] + public class GetPartnerProductSku : PartnerPSCmdlet + { + /// + /// Gets or sets the country code used to obtain product skus. + /// + [Parameter(ParameterSetName = "ByProductId", Mandatory = false, HelpMessage = "The country ISO2 code.")] + [Parameter(ParameterSetName = "BySkuId", Mandatory = false, HelpMessage = "The country ISO2 code.")] + [Parameter(ParameterSetName = "BySegment", Mandatory = false, HelpMessage = "The country ISO2 code.")] + public string CountryCode { get; set; } + + /// + /// Gets or sets the product identifier. + /// + [Parameter(ParameterSetName = "ByProductId", Mandatory = true, HelpMessage = "A string that identifies the product.")] + [Parameter(ParameterSetName = "BySkuId", Mandatory = true, HelpMessage = "A string that identifies the product.")] + [Parameter(ParameterSetName = "BySegment", Mandatory = true, HelpMessage = "A string that identifies the product.")] + public string ProductId { get; set; } + + /// + /// Gets or sets the sku identifier. + /// + [Parameter(ParameterSetName = "BySkuId", Mandatory = true, HelpMessage = "A string that identifies the sku.")] + public string SkuId { get; set; } + + /// + /// Gets or sets the product segment. + /// + [Parameter(ParameterSetName = "BySegment", Mandatory = false, HelpMessage = "A string that the product segment.")] + [ValidateSet("commercial", "education", "government", "nonprofit")] + public string Segment { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + string countryCode = (string.IsNullOrEmpty(CountryCode)) ? PartnerProfile.Instance.Context.CountryCode : CountryCode; + + ProductId.AssertNotEmpty(nameof(ProductId)); + + if (!string.IsNullOrEmpty(SkuId)) + { + GetProductSku(countryCode, ProductId, SkuId); + } + else + { + GetProductSkus(countryCode, ProductId, Segment); + } + } + + /// + /// Gets the specified product sku. + /// + /// The country used to obtain the offer. + /// Identifier for the product. + /// Identifier for the SKU. + /// + /// is empty or null. + /// or + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetProductSku(string countryCode, string productId, string skuId) + { + Sku sku; + + countryCode.AssertNotEmpty(nameof(countryCode)); + productId.AssertNotEmpty(nameof(productId)); + + try + { + sku = Partner.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Get(); + + if (sku != null) + { + WriteObject(new PSSku(sku)); + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting sku id: " + skuId, ex); + } + finally + { + sku = null; + } + } + + /// + /// Gets the specified product skus. + /// + /// The country used to obtain the offer. + /// Identifier for the product. + /// Identifier for the product. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetProductSkus(string countryCode, string productId, string segment) + { + ResourceCollection skus; + + countryCode.AssertNotEmpty(nameof(countryCode)); + productId.AssertNotEmpty(nameof(productId)); + + try + { + if (string.IsNullOrEmpty(segment)) + { + skus = Partner.Products.ByCountry(countryCode).ById(productId).Skus.Get(); + } + else + { + skus = Partner.Products.ByCountry(countryCode).ById(productId).Skus.ByTargetSegment(segment).Get(); + } + + if (skus.TotalCount > 0) + { + WriteObject(skus.Items.Select(s => new PSSku(s)), true); + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error getting skus for product id: " + productId, ex); + } + finally + { + skus = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerResellerRequestLink.cs b/src/PowerShell/Commands/GetPartnerResellerRequestLink.cs new file mode 100644 index 0000000..fa668f3 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerResellerRequestLink.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.CustomerRelationshipRequests; + using PartnerCenter.Models.RelationshipRequests; + + /// + /// Get the resller relationship request link. + /// + [Cmdlet(VerbsCommon.Get, "PartnerResellerRequestLink"), OutputType(typeof(PSCustomerRelationshipRequest))] + public class GetPartnerResellerRequestLink : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CustomerRelationshipRequest link; + + try + { + link = Partner.Customers.RelationshipRequest.Get(); + + WriteObject(new PSCustomerRelationshipRequest(link)); + } + finally + { + link = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerServiceIncident.cs b/src/PowerShell/Commands/GetPartnerServiceIncident.cs new file mode 100644 index 0000000..71c2c90 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerServiceIncident.cs @@ -0,0 +1,70 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using PartnerCenter.Models; + using PartnerCenter.Models.ServiceIncidents; + + /// + /// Gets a list of service incidents from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerServiceIncident"), OutputType(typeof(ServiceIncidentDetail))] + public class GetPartnerServiceIncident : PartnerPSCmdlet + { + /// + /// Gets or sets the optional status type. + /// + [Parameter(Mandatory = false, HelpMessage = "Specifies which status types to return.")] + [ValidateSet(nameof(ServiceIncidentStatus.Critical), nameof(ServiceIncidentStatus.Information), nameof(ServiceIncidentStatus.Normal), nameof(ServiceIncidentStatus.Warning))] + public ServiceIncidentStatus? Status { get; set; } + + /// + /// Gets or sets the optional Resolved switch. + /// + [Parameter(Mandatory = false, HelpMessage = "If specified resolved incidents are also returned.")] + public SwitchParameter Resolved { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + ResourceCollection incidents; + IEnumerable results; + + try + { + incidents = Partner.ServiceIncidents.Get(); + + if (incidents.TotalCount > 0) + { + results = incidents.Items.SelectMany(i => i.Incidents); + + if (Status.HasValue) + { + results = results.Where(i => i.Status == Status); + } + + if (!Resolved) + { + results = results.Where(i => i.Resolved == false); + } + + WriteObject(results, true); + } + } + finally + { + incidents = null; + results = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerServiceRequest.cs b/src/PowerShell/Commands/GetPartnerServiceRequest.cs new file mode 100644 index 0000000..a99185f --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerServiceRequest.cs @@ -0,0 +1,215 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models.ServiceRequests; + using PartnerCenter.Models; + using PartnerCenter.Models.ServiceRequests; + + /// + /// Get a service request, or a list of service requests, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerServiceRequest", DefaultParameterSetName = "ByStatus"), OutputType(typeof(PSServiceRequest))] + public class GetPartnerServiceRequest : PartnerPSCmdlet + { + /// + /// Gets or sets the request status + /// + [Parameter(ParameterSetName = "ByStatus", Mandatory = false, HelpMessage = "The status of the support request.")] + [Parameter(ParameterSetName = "BySeverity", Mandatory = false, HelpMessage = "The status of the support request.")] + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = false, HelpMessage = "The status of the support request.")] + [ValidateSet(nameof(ServiceRequestStatus.AttentionNeeded), nameof(ServiceRequestStatus.Closed), nameof(ServiceRequestStatus.None), nameof(ServiceRequestStatus.Open))] + public ServiceRequestStatus? Status { get; set; } + + /// + /// Gets or sets the request severity + /// + [Parameter(ParameterSetName = "ByStatus", Mandatory = false, HelpMessage = "The status of the support request.")] + [Parameter(ParameterSetName = "BySeverity", Mandatory = false, HelpMessage = "The status of the support request.")] + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = false, HelpMessage = "The status of the support request.")] + [ValidateSet(nameof(ServiceRequestSeverity.Critical), nameof(ServiceRequestSeverity.Minimal), nameof(ServiceRequestSeverity.Moderate), nameof(ServiceRequestSeverity.Unknown))] + public ServiceRequestSeverity? Severity { get; set; } + + /// + /// Gets or sets the customer identifier + /// + [Parameter(ParameterSetName = "ByCustomerId", Mandatory = true, HelpMessage = "The identifier of the customer.")] + [Parameter(ParameterSetName = "ByRequestId", Mandatory = true, HelpMessage = "The identifier of the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the service request identifier + /// + [Parameter(ParameterSetName = "ByRequestId", Mandatory = false, HelpMessage = "The identifier of the service request.")] + public string RequestId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(CustomerId)) + { + if (!string.IsNullOrEmpty(RequestId)) + { + GetCustomerServiceRequest(CustomerId, RequestId); + } + else + { + GetCustomerServiceRequests(CustomerId, Status, Severity); + } + } + else + { + if (!string.IsNullOrEmpty(RequestId)) + { + GetServiceRequest(RequestId); + } + else + { + GetServiceRequests(Status, Severity); + } + } + } + + /// + /// Gets the specified service request for a customer. + /// + /// Identifier for the customer. + /// Identifier for the service request. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private void GetCustomerServiceRequest(string customerId, string requestId) + { + ServiceRequest request; + + customerId.AssertNotEmpty(nameof(customerId)); + requestId.AssertNotEmpty(nameof(requestId)); + + try + { + request = Partner.Customers.ById(customerId).ServiceRequests.ById(requestId).Get(); + + if (request != null) + WriteObject(new PSServiceRequest(request)); + } + finally + { + request = null; + } + } + + /// + /// Gets a list of service requests for a customer. + /// + /// Identifier for the customer. + /// Identifier for the service request. + /// Identifier for the service request. + /// + /// is empty or null. + /// + private void GetCustomerServiceRequests(string customerId, ServiceRequestStatus? status, ServiceRequestSeverity? severity) + { + ResourceCollection requests; + IEnumerable results; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + requests = Partner.Customers.ById(customerId).ServiceRequests.Get(); + + if (requests.TotalCount > 0) + { + results = requests.Items; + + if (status.HasValue) + results = results.Where(r => r.Status == status); + + if (severity.HasValue) + results = results.Where(r => r.Severity == severity); + + WriteObject(results.Select(r => new PSServiceRequest(r)), true); + } + } + finally + { + requests = null; + results = null; + } + } + + /// + /// Gets the specified service request for a partner. + /// + /// Identifier for the service request. + /// + /// is empty or null. + /// + private void GetServiceRequest(string requestId) + { + ServiceRequest request; + + requestId.AssertNotEmpty(nameof(requestId)); + + try + { + request = Partner.ServiceRequests.ById(requestId).Get(); + + if (request != null) + WriteObject(new PSServiceRequest(request)); + } + finally + { + request = null; + } + } + + /// + /// Gets a list of service requests for a partner. + /// + /// Identifier for the service request. + /// Identifier for the service request. + private void GetServiceRequests(ServiceRequestStatus? status, ServiceRequestSeverity? severity) + { + ResourceCollection requests; + IEnumerable results; + + try + { + requests = Partner.ServiceRequests.Get(); + + if (requests.TotalCount > 0) + { + results = requests.Items; + + if (status.HasValue) + results = results.Where(r => r.Status == status); + + if (severity.HasValue) + results = results.Where(r => r.Severity == severity); + + WriteObject(results.Select(r => new PSServiceRequest(r)), true); + } + } + finally + { + requests = null; + results = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerServiceRequestTopic.cs b/src/PowerShell/Commands/GetPartnerServiceRequestTopic.cs new file mode 100644 index 0000000..3dd46b9 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerServiceRequestTopic.cs @@ -0,0 +1,64 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using Models.ServiceRequests; + using PartnerCenter.Models; + using PartnerCenter.Models.ServiceRequests; + + /// + /// Get a service request, or a list of service requests, from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerServiceRequestTopic"), OutputType(typeof(PSSupportTopic))] + public class GetPartnerServiceRequestTopic : PartnerPSCmdlet + { + /// + /// Gets or sets the support topic identifier + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier of the support topic.")] + public string SupportTopicId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() { GetSupportTopics(SupportTopicId); } + + /// + /// Gets the specified support topic. + /// + /// Identifier for the customer. + private void GetSupportTopics(string topicId) + { + ResourceCollection topics; + IEnumerable results; + + try + { + topics = Partner.ServiceRequests.SupportTopics.Get(); + + if (topics.TotalCount > 0) + { + results = topics.Items; + + if (!string.IsNullOrEmpty(topicId)) + results = results.Where(t => t.Id.ToString(CultureInfo.CurrentCulture) == topicId); + + WriteObject(results.Select(t => new PSSupportTopic(t)), true); + } + } + finally + { + topics = null; + results = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/GetPartnerSupportProfile.cs b/src/PowerShell/Commands/GetPartnerSupportProfile.cs new file mode 100644 index 0000000..f58f830 --- /dev/null +++ b/src/PowerShell/Commands/GetPartnerSupportProfile.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Models.Partners; + using PartnerCenter.Models.Partners; + + /// + /// Gets the partner support profile from Partner Center. + /// + [Cmdlet(VerbsCommon.Get, "PartnerSupportProfile"), OutputType(typeof(PSSupportProfile))] + public class GetPartnerSupportProfile : PartnerPSCmdlet + { + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + SupportProfile profile; + + try + { + profile = Partner.Profiles.SupportProfile.Get(); + + WriteObject(new PSSupportProfile(profile)); + } + finally + { + profile = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomer.cs b/src/PowerShell/Commands/NewPartnerCustomer.cs new file mode 100644 index 0000000..8cca659 --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomer.cs @@ -0,0 +1,212 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Globalization; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Authentication; + using Models.Customers; + using PartnerCenter.Models; + using PartnerCenter.Models.Customers; + using Properties; + using Validations; + + [Cmdlet(VerbsCommon.New, "PartnerCustomer", SupportsShouldProcess = true), OutputType(typeof(PSCustomer))] + public class NewPartnerCustomer : PartnerPSCmdlet + { + /// + /// Gets or sets the first line of the billing address. + /// + [Parameter(HelpMessage = "The first line of the customer's billing address.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string BillingAddressLine1 { get; set; } + + /// + /// Gets or sets the second line of the billing address. + /// + [Parameter(HelpMessage = "The second line of the customer's billing address.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string BillingAddressLine2 { get; set; } + + /// + /// Gets or sets the city of the billing address. + /// + [Parameter(HelpMessage = "The city of the customer's billing address.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string BillingAddressCity { get; set; } + + /// + /// Gets or sets the country of the billing address. + /// + [Parameter(HelpMessage = "The country of the customer's billing address.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string BillingAddressCountry { get; set; } + + /// + /// Gets or sets the postal code of the billing address. + /// + [Parameter(HelpMessage = "The postal code of the customer's billing address.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string BillingAddressPostalCode { get; set; } + + /// + /// Gets or sets the region of the billing address. + /// + [Parameter(HelpMessage = "The region of the customer's billing address.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string BillingAddressRegion { get; set; } + + /// + /// Gets or sets the state of the billing address. + /// + [Parameter(HelpMessage = "The state of the customer's billing address.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string BillingAddressState { get; set; } + + /// + /// Gets or sets the email address of the primary contact at the customer. + /// + [Parameter(HelpMessage = "The email address of the primary contact at the customer.", Mandatory = false)] + [ValidatePattern(@"^(?("")("".+?(? + /// Gets or sets the first name of the primary contact at the customer. + /// + [Parameter(HelpMessage = "The first name of the primary contact at the customer.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string ContactFirstName { get; set; } + + /// + /// Gets or sets the last name of the primary contact at the customer. + /// + [Parameter(HelpMessage = "The last name of the primary contact at the customer.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string ContactLastName { get; set; } + + /// + /// + /// + [Parameter(HelpMessage = "The phone number of the primary contact at the customer.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string ContactPhoneNumber { get; set; } + + /// + /// Gets or sets the preferred culture for communication and currency. + /// + [Parameter(HelpMessage = "The preferred culture for communication and currency.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string Culture { get; set; } + + /// + /// Gets or sets the domain of the customer. + /// + [Parameter(HelpMessage = "The customer's domain name, such as contoso.onmicrosoft.com.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Domain { get; set; } + + /// + /// Gets or sets the default language. Two character language codes (e.g., en, fr) are supported. + /// + [Parameter(HelpMessage = "The default language. Two character language codes (e.g., en, fr) are supported.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Language { get; set; } + + /// + /// Gets or sets the name of the customer. + /// + [Parameter(HelpMessage = "The name of the customer to be created.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Customer customer; + IValidator
validator; + string country; + string culture; + string region; + + try + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.NewPartnerCustomerWhatIf, Name))) + { + if (Partner.Domains.ByDomain(Domain).Exists()) + { + throw new PSInvalidOperationException( + string.Format( + CultureInfo.CurrentCulture, + Resources.DomainExistsError, + Domain)); + } + + country = (string.IsNullOrEmpty(BillingAddressCountry)) ? PartnerProfile.Instance.Context.CountryCode : BillingAddressCountry; + culture = (string.IsNullOrEmpty(Culture)) ? PartnerProfile.Instance.Context.Locale : Culture; + + if (string.IsNullOrEmpty(BillingAddressRegion)) + { + region = null; + } + else + { + region = BillingAddressRegion.Equals("US", StringComparison.InvariantCultureIgnoreCase) ? string.Empty : BillingAddressRegion; + } + + customer = new Customer + { + BillingProfile = new CustomerBillingProfile + { + CompanyName = Name, + Culture = culture, + DefaultAddress = new Address + { + AddressLine1 = BillingAddressLine1, + AddressLine2 = BillingAddressLine2, + City = BillingAddressCity, + Country = country, + FirstName = ContactFirstName, + LastName = ContactLastName, + PhoneNumber = ContactPhoneNumber, + PostalCode = BillingAddressPostalCode, + Region = region, + State = BillingAddressState + }, + Email = ContactEmail, + FirstName = ContactFirstName, + Language = Language, + LastName = ContactLastName + }, + CompanyProfile = new CustomerCompanyProfile + { + CompanyName = Name, + Domain = Domain + } + }; + + validator = new AddressValidator(Partner); + + if (validator.IsValid(customer.BillingProfile.DefaultAddress)) + { + customer = Partner.Customers.Create(customer); + + WriteObject(customer); + } + } + } + finally + { + customer = null; + validator = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerAgreement.cs b/src/PowerShell/Commands/NewPartnerCustomerAgreement.cs new file mode 100644 index 0000000..baa0c3f --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerAgreement.cs @@ -0,0 +1,109 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Agreements; + using PartnerCenter.Models.Agreements; + using Properties; + + /// + /// Create a new agreement for the specified customer. + /// + [Cmdlet(VerbsCommon.New, "PartnerCustomerAgreement"), OutputType(typeof(PSAgreement))] + public class NewPartnerCustomerAgreement : PartnerPSCmdlet + { + /// + /// Gets or sets the agreement type. + /// + [Parameter(HelpMessage = "The type of agreement being accepted.", Mandatory = true)] + [ValidateSet(nameof(AgreementType.MicrosoftCloudAgreement))] + public AgreementType AgreementType { get; set; } + + /// + /// Gets or sets the email address of the contact at the customer. + /// + [Parameter(HelpMessage = "The email address of the contact at the customer.", Mandatory = true)] + [ValidatePattern(@"^(?("")("".+?(? + /// Gets or sets the first name of the contact at the customer. + /// + [Parameter(HelpMessage = "The first name of the contact at the customer.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ContactFirstName { get; set; } + + /// + /// Gets or sets the last name of the contact at the customer. + /// + [Parameter(HelpMessage = "The last name of the contact at the customer.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ContactLastName { get; set; } + + /// + /// Gets or sets the phone number of the contact at the customer. + /// + [Parameter(HelpMessage = "The phone number of the contact at the customer.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string ContactPhoneNumber { get; set; } + + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the required template identifier. + /// + [Parameter(HelpMessage = "The identifier for the template.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string TemplateId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Agreement agreement; + + try + { + if (ShouldProcess(Resources.NewPartnerCustomerAgreementWhatIf)) + { + agreement = new Agreement + { + DateAgreed = DateTime.UtcNow, + PrimaryContact = new Contact + { + Email = ContactEmail, + FirstName = ContactFirstName, + LastName = ContactLastName, + PhoneNumber = ContactPhoneNumber + + }, + TemplateId = TemplateId, + Type = AgreementType, + UserId = Context.UserId + }; + + agreement = Partner.Customers[CustomerId].Agreements.Create(agreement); + + WriteObject(agreement); + } + } + finally + { + agreement = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerCart.cs b/src/PowerShell/Commands/NewPartnerCustomerCart.cs new file mode 100644 index 0000000..661248f --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerCart.cs @@ -0,0 +1,79 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models.Carts; + using PartnerCenter.Models.Carts; + using Properties; + + [Cmdlet(VerbsCommon.New, "PartnerCustomerCart", SupportsShouldProcess = true), OutputType(typeof(PSCart))] + public class NewPartnerCustomerCart : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets a collection of cart line items. + /// + [Parameter(HelpMessage = "A list of cart line items.", Mandatory = true)] + [ValidateNotNull] + public PSCartLineItem[] LineItems { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Cart cart; + CartLineItem cartLineItem; + List cartLineItems; + + try + { + if (!ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.NewCartWhatIf, CustomerId))) + { + return; + } + + cartLineItems = new List(); + + foreach (PSCartLineItem item in LineItems) + { + cartLineItem = new CartLineItem(); + cartLineItem.CopyFrom(item); + + cartLineItems.Add(cartLineItem); + } + + cart = new Cart + { + LineItems = cartLineItems + }; + + cart = Partner.Customers[CustomerId].Carts.Create(cart); + + WriteObject(new PSCart(cart)); + } + finally + { + cart = null; + cartLineItem = null; + cartLineItems = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerCartLineItem.cs b/src/PowerShell/Commands/NewPartnerCustomerCartLineItem.cs new file mode 100644 index 0000000..1d3b21a --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerCartLineItem.cs @@ -0,0 +1,120 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Carts; + using PartnerCenter.Models.Carts; + using PartnerCenter.Models.Products; + using Properties; + + [Cmdlet(VerbsCommon.New, "PartnerCustomerCartLineItem", SupportsShouldProcess = true), OutputType(typeof(PSCartLineItem))] + public class NewPartnerCustomerCartLineItem : PartnerPSCmdlet + { + /// + /// Gets or sets the type of billing cycle set for the current period. + /// + [Parameter(HelpMessage = "The type of billing cycle set for the current period.", Mandatory = true)] + [ValidateSet(nameof(BillingCycleType.Annual), nameof(BillingCycleType.Monthly), nameof(BillingCycleType.None), nameof(BillingCycleType.OneTime))] + public BillingCycleType BillingCycle { get; set; } + + /// + /// Gets or sets the required catalog item identifier + /// + [Parameter(HelpMessage = "The catalog item identifier.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CatalogItemId { get; set; } + + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the currency code. + /// + [Parameter(HelpMessage = "The currency code used when this line item is invoiced.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string CurrencyCode { get; set; } + + /// + /// Gets or sets the friendly name for the item defined by the partner to help disambiguate. + /// + [Parameter(HelpMessage = "The friendly name for the item defined by the partner to help disambiguate.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string FriendlyName { get; set; } + + /// + /// Gets or sets a group to indicate which items can be placed together. + /// + [Parameter(HelpMessage = "A group to indicate which items can be placed together.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string OrderGroup { get; set; } + + /// + /// Gets or sets a context used for provisioning of offer. + /// + [Parameter(HelpMessage = "A context used for provisioning of offer.", Mandatory = false)] + [ValidateNotNull] + public Hashtable ProvisioningContext { get; set; } + + /// + /// Gets or sets the number of licenses or instances. + /// + [Parameter(HelpMessage = "The number of licenses or instances.", Mandatory = false)] + [ValidateNotNull] + public int Quantity { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CartLineItem lineItem; + + try + { + if (!ShouldProcess(Resources.NewPartnerCustomerCartLineItemWhatIf)) + { + return; + } + + lineItem = new CartLineItem + { + CatalogItemId = CatalogItemId, + BillingCycle = BillingCycle, + CurrencyCode = CurrencyCode, + FriendlyName = FriendlyName, + OrderGroup = OrderGroup, + ProvisioningContext = new Dictionary(), + Quantity = Quantity + }; + + if (ProvisioningContext != null) + { + foreach (KeyValuePair value in ProvisioningContext.Cast() + .ToDictionary(d => d.Key, d => d.Value)) + { + lineItem.ProvisioningContext.Add(value.Key.ToString(), value.Value.ToString()); + } + } + + WriteObject(new PSCartLineItem(lineItem)); + } + finally + { + lineItem = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerConfigurationPolicy.cs b/src/PowerShell/Commands/NewPartnerCustomerConfigurationPolicy.cs new file mode 100644 index 0000000..6277339 --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerConfigurationPolicy.cs @@ -0,0 +1,109 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models; + using PartnerCenter.Models.DevicesDeployment; + using PartnerCenter.PowerShell.Properties; + + /// + /// Creates a new configuration policies for the specified customer identifier. + /// + [Cmdlet(VerbsCommon.New, "PartnerCustomerConfigurationPolicy", SupportsShouldProcess = true), OutputType(typeof(PSConfigurationPolicy))] + public class NewPartnerCustomerConfigurationPolicy : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, Position = 0, HelpMessage = "Identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the required policy name. + /// + [Parameter(Mandatory = true, Position = 1, HelpMessage = "Policy name for the new policy.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + /// + /// Gets or sets the optional policy description. + /// + [Parameter(Mandatory = false, HelpMessage = "Description for the new policy.")] + [ValidateNotNullOrEmpty] + public string Description { get; set; } + + /// + /// Gets or sets the optional skip privacy setup policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Remove OEM preinstalls policy.")] + public bool RemoveOemPreinstalls { get; set; } + + /// + /// Gets or sets the optional Disable local admin account in setup policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Disable local admin account in setup policy.")] + public bool OobeUserNotLocalAdmin { get; set; } + + /// + /// Gets or sets the optional Automatically skip pages in setup policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Automatically skip pages in setup policy.")] + public bool SkipExpressSettings { get; set; } + + /// + /// Gets or sets the optional Skip end user license agreement (EULA) policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Skip end user license agreement (EULA) policy.")] + public bool SkipEula { get; set; } + + /// + /// Gets or sets the optional Skip end registration policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Skip OEM registration policy.")] + public bool SkipOemRegistration { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (!ShouldProcess(Resources.NewPartnerCustomerConfigurationPolicyWhatIf)) return; + + List policySettings = new List(); + if (OobeUserNotLocalAdmin) policySettings.Add(PolicySettingsType.OobeUserNotLocalAdmin); + if (SkipEula) policySettings.Add(PolicySettingsType.SkipEula); + if (SkipExpressSettings) policySettings.Add(PolicySettingsType.SkipExpressSettings); + if (RemoveOemPreinstalls) policySettings.Add(PolicySettingsType.RemoveOemPreinstalls); + if (SkipOemRegistration) policySettings.Add(PolicySettingsType.SkipOemRegistration); + + ConfigurationPolicy configurationPolicy = new ConfigurationPolicy + { + Name = Name, + Description = Description, + PolicySettings = policySettings + }; + + ConfigurationPolicy devicePolicy; + CustomerId.AssertNotEmpty(nameof(CustomerId)); + + try + { + devicePolicy = Partner.Customers[CustomerId].ConfigurationPolicies.Create(configurationPolicy); + WriteObject(new PSConfigurationPolicy(devicePolicy)); + } + finally + { + devicePolicy = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerOrder.cs b/src/PowerShell/Commands/NewPartnerCustomerOrder.cs new file mode 100644 index 0000000..67e80cd --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerOrder.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using PartnerCenter.Models.Orders; + using PartnerCenter.PowerShell.Models.Orders; + + [Cmdlet(VerbsCommon.New, "PartnerCustomerOrder", SupportsShouldProcess = true), OutputType(typeof(PSOrder))] + public class NewPartnerCustomerOrder : PartnerPSCmdlet + { + /// + /// Gets or sets the identifier of the customer making the purchase. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the order line items. Each order line item refers to one offer's purchase data. + /// + [Parameter(HelpMessage = "The order line items. Each order line item refers to one offer's purchase data.", Mandatory = true)] + public PSOrderLineItem[] LineItems { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Order newOrder; + + try + { + newOrder = new Order + { + LineItems = LineItems.Select(o => o.ToOrderLineItem()), + ReferenceCustomerId = CustomerId + }; + + newOrder = Partner.Customers[CustomerId].Orders.Create(newOrder); + + WriteObject(new PSOrder(newOrder)); + } + finally + { + newOrder = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerOrderLineItem.cs b/src/PowerShell/Commands/NewPartnerCustomerOrderLineItem.cs new file mode 100644 index 0000000..317b36c --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerOrderLineItem.cs @@ -0,0 +1,120 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using PartnerCenter.PowerShell.Models.Orders; + using Properties; + + [Cmdlet(VerbsCommon.New, "PartnerCustomerOrderLineItem", SupportsShouldProcess = true), OutputType(typeof(PSOrderLineItem))] + public class NewPartnerCustomerOrderLineItem : PartnerPSCmdlet + { + /// + /// Gets or sets the friendly name for the result contract (subscription). + /// + [Parameter(HelpMessage = "The friendly name for the result contract (subscription).", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string FriendlyName { get; set; } + + /// + /// Gets or sets the line item number. + /// + [Parameter(HelpMessage = "The line item number.", Mandatory = true)] + [ValidateNotNull] + public int LineItemNumber { get; set; } + + /// + /// Gets or sets the offer identifier. + /// + [Parameter(HelpMessage = "The offer identifier.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OfferId { get; set; } + + /// + /// Gets or sets the partner identifier on record. + /// + [Parameter(HelpMessage = "The partner identifier on record.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string PartnerIdOnRecord { get; set; } + + /// + /// Gets or sets the parent subscription identifier. + /// + /// + /// This parameter should only be set for add-on offer purchase. This applies to Order updates only. + /// + [Parameter(HelpMessage = "The parent subscription identifier.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string ParentSubscriptionId { get; set; } + + /// + /// Gets or sets the provisioning context for the offer. + /// + [Parameter(HelpMessage = "The provisioning context for the offer.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public Hashtable ProvisioningContext { get; set; } + + /// + /// Gets or sets the product quantity. + /// + [Parameter(HelpMessage = "The product quantity.", Mandatory = true)] + [ValidateNotNull] + public int Quantity { get; set; } + + /// + /// Gets or sets the resulting subscription identifier. + /// + [Parameter(HelpMessage = "The resulting subscription identifier.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + PSOrderLineItem orderLineItem; + + try + { + if (!ShouldProcess(Resources.NewPartnerCustomerOrderLineItemWhatIf)) + { + return; + } + + orderLineItem = new PSOrderLineItem + { + FriendlyName = FriendlyName, + LineItemNumber = LineItemNumber, + OfferId = OfferId, + ParentSubscriptionId = ParentSubscriptionId, + PartnerIdOnRecord = PartnerIdOnRecord, + Quantity = Quantity, + SubscriptionId = SubscriptionId + }; + + if (ProvisioningContext != null) + { + foreach (KeyValuePair value in ProvisioningContext.Cast() + .ToDictionary(d => d.Key, d => d.Value)) + { + orderLineItem.ProvisioningContext.Add(value.Key.ToString(), value.Value.ToString()); + } + } + + WriteObject(orderLineItem); + } + finally + { + orderLineItem = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerSubscriptionRegistration.cs b/src/PowerShell/Commands/NewPartnerCustomerSubscriptionRegistration.cs new file mode 100644 index 0000000..87277bb --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerSubscriptionRegistration.cs @@ -0,0 +1,49 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Properties; + + /// + /// Registers an existing Subscription so that it is enabled for ordering Azure Reserved VM Instances. + /// + [Cmdlet(VerbsCommon.New, "PartnerCustomerSubscriptionRegistration", SupportsShouldProcess = true), OutputType(typeof(string))] + public class NewPartnerCustomerSubscriptionRegistration : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the required subscription identifier. + /// + [Parameter(HelpMessage = "The identifier for the subscription.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (ShouldProcess(string.Format( + CultureInfo.CurrentCulture, + Resources.SubscriptionRegistrationWhatIf, + SubscriptionId, + CustomerId))) + { + WriteObject(Partner.Customers[CustomerId].Subscriptions[SubscriptionId].Registration.Register()); + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/NewPartnerCustomerUser.cs b/src/PowerShell/Commands/NewPartnerCustomerUser.cs new file mode 100644 index 0000000..d9520b0 --- /dev/null +++ b/src/PowerShell/Commands/NewPartnerCustomerUser.cs @@ -0,0 +1,122 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Security; + using System.Text.RegularExpressions; + using Authentication; + using Common; + using Exceptions; + using Models.CustomerUsers; + using PartnerCenter.Models.Users; + using Properties; + + [Cmdlet(VerbsCommon.New, "PartnerCustomerUser", SupportsShouldProcess = true), OutputType(typeof(PSCustomerUser))] + public class NewPartnerCustomerCustomer : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the first name of the customer user. + /// + [Parameter(HelpMessage = "The first name for the new customer user.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string FirstName { get; set; } + + /// + /// Gets or sets the last name for the customer user. + /// + [Parameter(HelpMessage = "The last name for the new customer user.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string LastName { get; set; } + + /// + /// Gets or sets the display name for the customer user. + /// + [Parameter(HelpMessage = "The display name for the new customer user.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DisplayName { get; set; } + + /// + /// Gets or sets the user pricipal name for the customer user. + /// + [Parameter(HelpMessage = "The user principal name (UPN) for the new customer user, including the onmicrosoft.com domain name.", Mandatory = true)] + [ValidateNotNullOrEmpty] + public string UserPrincipalName { get; set; } + + /// + /// Gets or sets the password for the customer user. + /// + [Parameter(HelpMessage = "The password for the new custom user as a secure string", Mandatory = true)] + [ValidateNotNull] + public SecureString Password { get; set; } + + /// + /// Gets or sets the force password change at next login for the new customer user. + /// + [Parameter(Mandatory = false, HelpMessage = "Forces user to change password during next login.")] + public SwitchParameter ForceChangePassword { get; set; } + + /// + /// Gets or sets the customer user region. + /// + [Parameter(HelpMessage = "The location where the customer user will use software and services. Service availability varies by region.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string UsageLocation { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CustomerUser newUser; + string country; + CustomerId.AssertNotEmpty(nameof(CustomerId)); + + try + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.NewPartnerCustomerUserWhatIf, UserPrincipalName))) + { + country = (string.IsNullOrEmpty(UsageLocation)) ? PartnerProfile.Instance.Context.CountryCode : UsageLocation; + string stringPassword = SecureStringExtensions.ConvertToString(Password); + + newUser = new CustomerUser + { + PasswordProfile = new PasswordProfile() + { + ForceChangePassword = ForceChangePassword.IsPresent, + Password = stringPassword + }, + DisplayName = DisplayName, + FirstName = FirstName, + LastName = LastName, + UsageLocation = country, + UserPrincipalName = UserPrincipalName + }; + CustomerUser createdUser = Partner.Customers[CustomerId].Users.Create(newUser); + WriteObject(new PSCustomerUser(createdUser)); + } + } + catch (PSPartnerException ex) + { + throw new PSPartnerException("Error creating user:" + UserPrincipalName, ex); + } + finally + { + newUser = null; + country = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/PartnerPSCmdlet.cs b/src/PowerShell/Commands/PartnerPSCmdlet.cs new file mode 100644 index 0000000..ed33bc9 --- /dev/null +++ b/src/PowerShell/Commands/PartnerPSCmdlet.cs @@ -0,0 +1,66 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Authentication; + using Properties; + + /// + /// Represents base class for all Partner Center cmdlets. + /// + public abstract class PartnerPSCmdlet : PSCmdlet + { + /// + /// Gets the parnter's execution context. + /// + /// + /// Connect-PartnerCenter has not been successfully executed. + /// + internal static PartnerContext Context + { + get + { + if (PartnerProfile.Instance.Context == null) + { + throw new PSInvalidOperationException(Resources.RunConnectPartnerCenter); + } + + return PartnerProfile.Instance.Context; + } + } + + /// + /// Provides access to the available Partner Center operations. + /// + internal IPartner Partner { get; private set; } + + /// + /// Operations that happen before the cmdlet is executed. + /// + protected override void BeginProcessing() + { + Partner = PartnerSession.Instance.ClientFactory.CreatePartnerOperations(Context); + } + + /// + /// Performs the execution of the command. + /// + protected override void ProcessRecord() + { + base.ProcessRecord(); + ExecuteCmdlet(); + } + + /// + /// Executes the operations associated with the cmdlet. + /// + public virtual void ExecuteCmdlet() + { + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/RemovePartnerCustomerConfigurationPolicy.cs b/src/PowerShell/Commands/RemovePartnerCustomerConfigurationPolicy.cs new file mode 100644 index 0000000..b286f1f --- /dev/null +++ b/src/PowerShell/Commands/RemovePartnerCustomerConfigurationPolicy.cs @@ -0,0 +1,59 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Text.RegularExpressions; + using PartnerCenter.Exceptions; + using PartnerCenter.PowerShell.Exceptions; + using PartnerCenter.PowerShell.Properties; + + /// + /// Return a list of configuration policies or a specific configration policy for the specified customer identifier. + /// + [Cmdlet(VerbsCommon.Remove, "PartnerCustomerConfigurationPolicy"), OutputType(typeof(bool))] + public class RemovePartnerCustomerConfigurationPolicy : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional configuration policy identifier. + /// + /// + /// If this parameter is not specified then a list of all policies for the specified customer will be returned. + /// When it is specified then the policy associated with the identifier will be returned. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier for the configuration policy.")] + [ValidateNotNullOrEmpty] + public string PolicyId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (!ShouldProcess(Resources.RemovePartnerCustomerConfigurationPolicyWhatIf, PolicyId)) return; + + try + { + Partner.Customers[CustomerId].ConfigurationPolicies[PolicyId].Delete(); + WriteObject(true); + } + catch (PartnerException ex) + { + throw new PSPartnerException("An error was encountered deleting policy id " + PolicyId, ex); + } + finally + { } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/RemovePartnerCustomerUser.cs b/src/PowerShell/Commands/RemovePartnerCustomerUser.cs new file mode 100644 index 0000000..e25e9d2 --- /dev/null +++ b/src/PowerShell/Commands/RemovePartnerCustomerUser.cs @@ -0,0 +1,180 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Exceptions; + using PartnerCenter.Enumerators; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Users; + using Properties; + + /// + /// Gets a list of users for a customer from Partner Center. + /// + [Cmdlet(VerbsCommon.Remove, "PartnerCustomerUser", DefaultParameterSetName = "ByUserId", SupportsShouldProcess = true), OutputType(typeof(bool))] + public class RemovePartnerCustomerUser : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByUpn", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional user identifier. + /// + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, HelpMessage = "The identifier for the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the optional user principal name. + /// + [Parameter(ParameterSetName = "ByUpn", Mandatory = true, HelpMessage = "The user principal name for the user.")] + [ValidateNotNullOrEmpty] + public string UserPrincipalName { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.RemovePartnerCustomerUserWhatIf, UserId))) + { + switch (ParameterSetName) + { + case "ByUpn": + RemoveUserByUpn(CustomerId, UserPrincipalName); + break; + case "ByUserId": + RemoveUserById(CustomerId, UserId); + break; + } + } + } + + /// + /// Gets a details for a specified user and customer from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// + private void RemoveUserById(string customerId, string userId) + { + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + bool success = true; + + try + { + Partner.Customers.ById(customerId).Users.ById(userId).Delete(); + WriteObject(success); + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error deleting user id: " + userId, ex); + } + finally + { + customerId = null; + userId = null; + } + } + + /// + /// Removes the customer user from Partner Center based on the specified user principal name. + /// + /// Identifier of the customer. + /// Identifier of the user principal name. + /// + /// is empty or null. + /// + private void RemoveUserByUpn(string customerId, string userPrincipalName) + { + customerId.AssertNotEmpty(nameof(customerId)); + customerId.AssertNotEmpty(nameof(userPrincipalName)); + + string userIdToDelete = GetUserIdByUpn(customerId, userPrincipalName); + + RemoveUserById(customerId, userIdToDelete); + } + + /// + /// Gets a user id by searching for the user principal name from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user principal name. + /// + /// is empty or null. + /// + private string GetUserIdByUpn(string customerId, string userPrincipalName) + { + customerId.AssertNotEmpty(nameof(customerId)); + customerId.AssertNotEmpty(nameof(userPrincipalName)); + + List gUsers = GetUsers(customerId); + + try + { + return (gUsers.Where(u => string.Equals(u.UserPrincipalName, userPrincipalName, StringComparison.CurrentCultureIgnoreCase)).First()).Id; + } + catch + { + throw new PSPartnerException("Error finding user id for " + userPrincipalName); + } + } + + /// + /// Gets a list of users from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private List GetUsers(string customerId) + { + IResourceCollectionEnumerator> usersEnumerator; + List users; + SeekBasedResourceCollection seekUsers; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + users = new List(); + + seekUsers = Partner.Customers[customerId].Users.Get(); + usersEnumerator = Partner.Enumerators.CustomerUsers.Create(seekUsers); + + while (usersEnumerator.HasValue) + { + users.AddRange(usersEnumerator.Current.Items); + usersEnumerator.Next(); + } + + return users; + } + finally + { + seekUsers = null; + usersEnumerator = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/RemovePartnerCustomerUserRoleMember.cs b/src/PowerShell/Commands/RemovePartnerCustomerUserRoleMember.cs new file mode 100644 index 0000000..6f20712 --- /dev/null +++ b/src/PowerShell/Commands/RemovePartnerCustomerUserRoleMember.cs @@ -0,0 +1,63 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Exceptions; + + /// + /// Gets a list of roles for the specified customer user from Partner Center. + /// + [Cmdlet(VerbsCommon.Remove, "PartnerCustomerUserRoleMember"), OutputType(typeof(bool))] + public class RemovePartnerCustomerUserRoleMember : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier of the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the user identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "The identifier of the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the role identifier. + /// + [Parameter(Mandatory = false, HelpMessage = "Identifier for the role.")] + public string RoleId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CustomerId.AssertNotEmpty(nameof(CustomerId)); + UserId.AssertNotEmpty(nameof(UserId)); + RoleId.AssertNotEmpty(nameof(RoleId)); + + try + { + Partner.Customers[CustomerId].DirectoryRoles[RoleId].UserMembers[UserId].Delete(); + WriteObject(true); + } + catch (PSPartnerException ex) + { + throw new PSPartnerException("Error removing user " + UserId + "from role " + RoleId, ex); + } + finally + { + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/RemovePartnerSandboxCustomer.cs b/src/PowerShell/Commands/RemovePartnerSandboxCustomer.cs new file mode 100644 index 0000000..2eb5e9e --- /dev/null +++ b/src/PowerShell/Commands/RemovePartnerSandboxCustomer.cs @@ -0,0 +1,39 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Properties; + + /// + /// Removes a customer from the partner (this is only support within the integration sandbox). + /// + [Cmdlet(VerbsCommon.Remove, "PartnerSandboxCustomer", ConfirmImpact = ConfirmImpact.High, SupportsShouldProcess = true), OutputType(typeof(bool))] + public class RemovePartnerSandboxCustomer : PartnerPSCmdlet + { + /// + /// Gets or sets the customer identifier. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true, Position = 0)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.RemovePartnerCustomerUserWhatIf, CustomerId))) + { + Partner.Customers[CustomerId].Delete(); + WriteObject(true); + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/RestorePartnerCustomerUser.cs b/src/PowerShell/Commands/RestorePartnerCustomerUser.cs new file mode 100644 index 0000000..efed317 --- /dev/null +++ b/src/PowerShell/Commands/RestorePartnerCustomerUser.cs @@ -0,0 +1,185 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using PartnerCenter.Enumerators; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Query; + using PartnerCenter.Models.Users; + using PartnerCenter.PowerShell.Exceptions; + using Properties; + + /// + /// Gets a list of users for a customer from Partner Center. + /// + [Cmdlet(VerbsData.Restore, "PartnerCustomerUser", DefaultParameterSetName = "ByUserId", SupportsShouldProcess = true), OutputType(typeof(bool))] + public class RestorePartnerCustomerUser : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [Parameter(ParameterSetName = "ByUpn", Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the optional user identifier. + /// + [Parameter(ParameterSetName = "ByUserId", Mandatory = true, HelpMessage = "The identifier for the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the optional user principal name. + /// + [Parameter(ParameterSetName = "ByUpn", Mandatory = true, HelpMessage = "The user principal name for the user.")] + [ValidateNotNull] + public string UserPrincipalName { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.RestorePartnerCustomerUserWhatIf, UserId))) + { + switch (ParameterSetName) + { + case "ByUpn": + RestoreUserByUpn(CustomerId, UserPrincipalName); + break; + case "ByUserId": + RestoreUserById(CustomerId, UserId); + break; + } + } + } + + /// + /// Restores the specified customer user id. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// + private void RestoreUserById(string customerId, string userId) + { + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + + CustomerUser updatedCustomerUser = new CustomerUser + { + State = UserState.Active + }; + + try + { + Partner.Customers.ById(customerId).Users.ById(userId).Patch(updatedCustomerUser); + WriteObject(true); + } + catch (PartnerException ex) + { + throw new PSPartnerException("Error restoring user id: " + userId, ex); + } + finally + { + customerId = null; + userId = null; + } + } + + /// + /// Restores the customer user from Partner Center based on the specified user principal name. + /// + /// Identifier of the customer. + /// Identifier of the user principal name. + /// + /// is empty or null. + /// + private void RestoreUserByUpn(string customerId, string userPrincipalName) + { + customerId.AssertNotEmpty(nameof(customerId)); + customerId.AssertNotEmpty(nameof(userPrincipalName)); + + RestoreUserById(customerId, GetUserIdByUpn(customerId, userPrincipalName)); + } + + /// + /// Gets a user id by searching for the user principal name from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user principal name. + /// + /// is empty or null. + /// + private string GetUserIdByUpn(string customerId, string userPrincipalName) + { + customerId.AssertNotEmpty(nameof(customerId)); + customerId.AssertNotEmpty(nameof(userPrincipalName)); + + List gUsers = GetDeletedUsers(customerId); + + try + { + return (gUsers.Where(u => string.Equals(u.UserPrincipalName, userPrincipalName, StringComparison.CurrentCultureIgnoreCase)).First()).Id; + } + catch + { + throw new PSPartnerException("Error finding user id for " + userPrincipalName); + } + } + + /// + /// Gets a list of deleted users from Partner Center. + /// + /// Identifier of the customer. + /// + /// is empty or null. + /// + private List GetDeletedUsers(string customerId) + { + SimpleFieldFilter filter = new SimpleFieldFilter("UserState", FieldFilterOperation.Equals, "Inactive"); + IQuery simpleQueryWithFilter = QueryFactory.Instance.BuildSimpleQuery(filter); + IResourceCollectionEnumerator> usersEnumerator; + List users; + SeekBasedResourceCollection seekUsers; + + customerId.AssertNotEmpty(nameof(customerId)); + + try + { + users = new List(); + + seekUsers = Partner.Customers[customerId].Users.Query(simpleQueryWithFilter); + usersEnumerator = Partner.Enumerators.CustomerUsers.Create(seekUsers); + while (usersEnumerator.HasValue) + { + users.AddRange(usersEnumerator.Current.Items); + usersEnumerator.Next(); + } + + return users; + } + finally + { + users = null; + seekUsers = null; + usersEnumerator = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerBillingProfile.cs b/src/PowerShell/Commands/SetPartnerBillingProfile.cs new file mode 100644 index 0000000..15f6223 --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerBillingProfile.cs @@ -0,0 +1,176 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Exceptions; + using Models.Partners; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Partners; + using Validations; + + /// + /// Sets the partner billing profile in Partner Center. + /// + [Cmdlet(VerbsCommon.Set, "PartnerBillingProfile", SupportsShouldProcess = true), OutputType(typeof(PSBillingProfile))] + public class SetPartnerBillingProfile : PartnerPSCmdlet + { + /// + /// Gets or sets the first line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The first line of the address.")] + [ValidateNotNullOrEmpty] + public string AddressLine1 { get; set; } + + /// + /// Gets or sets the second line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The second line of the adress.")] + [ValidateNotNullOrEmpty] + public string AddressLine2 { get; set; } + + /// + /// Gets or sets the city portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The city portion of the address.")] + [ValidateNotNullOrEmpty] + public string City { get; set; } + + /// + /// Gets or sets the email address of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The email address of the primary billing contact.")] + [ValidatePattern(@"^(?("")("".+?(? + /// Gets or sets the first name of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The first name of the primary billing contact.")] + [ValidateNotNullOrEmpty] + public string FirstName { get; set; } + + /// + /// Gets or sets the last name of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The last name of the primary billing contact.")] + [ValidateNotNullOrEmpty] + public string LastName { get; set; } + + /// + /// Gets or sets the phone number of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The phone number of the primary billing contact.")] + [ValidateNotNullOrEmpty] + public string PhoneNumber { get; set; } + + /// + /// Gets or sets the postal code portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The postal code portion of the address.")] + [ValidateNotNullOrEmpty] + public string PostalCode { get; set; } + + /// + /// Gets or sets the purcahse order number to be used for billing purposes. + /// + [Parameter(Mandatory = false, HelpMessage = "The purchase order number to be used for billing purposes.")] + [ValidateNotNullOrEmpty] + public string PurchaseOrderNumber { get; set; } + + /// + /// Gets or sets the region portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The region portion of the address.")] + [ValidateNotNullOrEmpty] + public string Region { get; set; } + + /// + /// Gets or sets the state portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The state portion of the address.")] + [ValidateNotNullOrEmpty] + public string State { get; set; } + + /// + /// Gets or sets the tax identifier used for billing purposes. + /// + [Parameter(Mandatory = false, HelpMessage = "The tax identifier to be used for billing purposes.")] + [ValidateNotNullOrEmpty] + public string TaxId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + BillingProfile profile; + IValidator
validator; + + try + { + if (ShouldProcess("Updates the partner's billing profile")) + { + profile = Partner.Profiles.BillingProfile.Get(); + + profile.Address.AddressLine1 = UpdateValue(AddressLine1, profile.Address.AddressLine1); + profile.Address.AddressLine2 = UpdateValue(AddressLine2, profile.Address.AddressLine2); + profile.Address.City = UpdateValue(City, profile.Address.City); + profile.Address.PostalCode = UpdateValue(PostalCode, profile.Address.PostalCode); + profile.Address.Region = UpdateValue(Region, profile.Address.Region); + profile.Address.State = UpdateValue(State, profile.Address.State); + + try + { + validator = new AddressValidator(Partner); + + if (!validator.IsValid(profile.Address)) + { + throw new PSInvalidOperationException("The specified address is invalid. Please verify the address and try again."); + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("The specified address is invalid. Please verify the address and try again.", ex); + } + + profile.PrimaryContact.Email = UpdateValue(EmailAddress, profile.PrimaryContact.Email); + profile.PrimaryContact.FirstName = UpdateValue(FirstName, profile.PrimaryContact.FirstName); + profile.PrimaryContact.LastName = UpdateValue(LastName, profile.PrimaryContact.LastName); + profile.PrimaryContact.PhoneNumber = UpdateValue(PhoneNumber, profile.PrimaryContact.PhoneNumber); + + profile.PurchaseOrderNumber = UpdateValue(PurchaseOrderNumber, profile.PurchaseOrderNumber); + profile.TaxId = UpdateValue(TaxId, profile.TaxId); + + Partner.Profiles.BillingProfile.Update(profile); + + WriteObject(new PSBillingProfile(profile)); + } + } + finally + { + profile = null; + validator = null; + } + } + + private static string UpdateValue(string input, string output) + { + string newValue = output; + + if (!string.IsNullOrEmpty(input) && !input.Equals(output, StringComparison.OrdinalIgnoreCase)) + { + newValue = input; + } + + return newValue; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerCustomer.cs b/src/PowerShell/Commands/SetPartnerCustomer.cs new file mode 100644 index 0000000..2b001dd --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerCustomer.cs @@ -0,0 +1,158 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Converts; + using Exceptions; + using Models.Customers; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Customers; + using Properties; + using Validations; + + [Cmdlet(VerbsCommon.Set, "PartnerCustomer", DefaultParameterSetName = "Customer", SupportsShouldProcess = true)] + [OutputType(typeof(PSCustomer))] + public class SetPartnerCustomer : PartnerPSCmdlet + { + /// + /// Gets or sets the customer being modified. + /// + [Parameter( + HelpMessage = "The customer object to be modified.", + Mandatory = true, + ParameterSetName = "CustomerObject", + ValueFromPipeline = true)] + [ValidateNotNull] + public PSCustomer InputObject { get; set; } + + /// + /// Gets or sets the first line of the billing address. + /// + [Parameter(HelpMessage = "The first line of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The first line of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressLine1 { get; set; } + + /// + /// Gets or sets the second line of the billing address. + /// + [Parameter(HelpMessage = "The second line of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The second line of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressLine2 { get; set; } + + /// + /// Gets or sets the city of the billing address. + /// + [Parameter(HelpMessage = "The city of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The city of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressCity { get; set; } + + /// + /// Gets or sets the country of the billing address. + /// + [Parameter(HelpMessage = "The country of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The county of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressCountry { get; set; } + + /// + /// Gets or sets the postal code of the billing address. + /// + [Parameter(HelpMessage = "The postal code of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The postal code of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressPostalCode { get; set; } + + /// + /// Gets or sets the region of the billing address. + /// + [Parameter(HelpMessage = "The region of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The region of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressRegion { get; set; } + + /// + /// Gets or sets the state of the billing address. + /// + [Parameter(HelpMessage = "The state of the customer's billing address.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "The state of the customer's billing address.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string BillingAddressState { get; set; } + + /// + /// Gets or sets the identifier of the customer. + /// + [Parameter(HelpMessage = "The identifier of the customer.", Mandatory = true, ParameterSetName = "Customer")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the name of the customer. + /// + [Parameter(HelpMessage = "Name of the customer.", Mandatory = false, ParameterSetName = "Customer")] + [Parameter(HelpMessage = "Name of the customer.", Mandatory = false, ParameterSetName = "CustomerObject")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CustomerConverter converter; + Customer customer; + IValidator
validator; + string customerId; + + try + { + customerId = (InputObject == null) ? CustomerId : InputObject.CustomerId; + + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.SetPartnerCustomerWhatIf, customerId))) + { + if (InputObject == null && string.IsNullOrEmpty(CustomerId)) + { + throw new PSInvalidOperationException(Resources.InvalidSetCustomerIdentifierException); + } + + customer = Partner.Customers[customerId].Get(); + + converter = new CustomerConverter(this, customer); + converter.Convert(); + + validator = new AddressValidator(Partner); + + if (validator.IsValid(customer.BillingProfile.DefaultAddress)) + { + Partner.Customers[customerId].Profiles.Billing.Update(customer.BillingProfile); + + WriteObject(new PSCustomer(customer)); + } + else + { + throw new PSInvalidOperationException("The address specified was invalid. Please check the values and try again."); + } + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("An error was encountered when communicating with Partner Center.", ex); + } + finally + { + converter = null; + customer = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerCustomerConfigurationPolicy.cs b/src/PowerShell/Commands/SetPartnerCustomerConfigurationPolicy.cs new file mode 100644 index 0000000..5f1e281 --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerCustomerConfigurationPolicy.cs @@ -0,0 +1,137 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Collections.Generic; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Common; + using Models; + using PartnerCenter.Models.DevicesDeployment; + using PartnerCenter.PowerShell.Properties; + + /// + /// Creates a new configuration policies for the specified customer identifier. + /// + [Cmdlet(VerbsCommon.Set, "PartnerCustomerConfigurationPolicy", SupportsShouldProcess = true), OutputType(typeof(PSConfigurationPolicy))] + public class SetPartnerCustomerConfigurationPolicy : PartnerPSCmdlet + { + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the required policy identifier. + /// + [Parameter(Mandatory = true, HelpMessage = "The identifier for the policy.")] + [ValidateNotNullOrEmpty] + public string PolicyId { get; set; } + + /// + /// Gets or sets the policy name. + /// + [Parameter(Mandatory = false, HelpMessage = "Policy name for the policy.")] + public string Name { get; set; } + + /// + /// Gets or sets the optional policy description. + /// + [Parameter(Mandatory = false, HelpMessage = "Description for the policy.")] + public string Description { get; set; } + + /// + /// Gets or sets the optional skip privacy setup policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Remove OEM preinstalls policy.")] + public bool RemoveOemPreinstalls { get; set; } + + /// + /// Gets or sets the optional Disable local admin account in setup policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Disable local admin account in setup policy.")] + public bool OobeUserNotLocalAdmin { get; set; } + + /// + /// Gets or sets the optional Automatically skip pages in setup policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Automatically skip pages in setup policy.")] + public bool SkipExpressSettings { get; set; } + + /// + /// Gets or sets the optional Skip end user license agreement (EULA) policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Skip end user license agreement (EULA) policy.")] + public bool SkipEula { get; set; } + + /// + /// Gets or sets the optional Skip end registration policy setting. + /// + [Parameter(Mandatory = false, HelpMessage = "Enables or disables the Skip OEM registration policy.")] + public bool SkipOemRegistration { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + + if (!ShouldProcess(Resources.SetPartnerCustomerConfigurationPolicyWhatIf, PolicyId)) return; + + List policySettings = new List(); + if (OobeUserNotLocalAdmin) policySettings.Add(PolicySettingsType.OobeUserNotLocalAdmin); + if (SkipEula) policySettings.Add(PolicySettingsType.SkipEula); + if (SkipExpressSettings) policySettings.Add(PolicySettingsType.SkipExpressSettings); + if (RemoveOemPreinstalls) policySettings.Add(PolicySettingsType.RemoveOemPreinstalls); + if (SkipOemRegistration) policySettings.Add(PolicySettingsType.SkipOemRegistration); + + ConfigurationPolicy configurationPolicy = GetCustomerPolicy(CustomerId, PolicyId); + + if (!string.IsNullOrEmpty(Name)) configurationPolicy.Name = Name; + if (!string.IsNullOrEmpty(Description)) configurationPolicy.Description = Description; + configurationPolicy.PolicySettings = policySettings; + + ConfigurationPolicy devicePolicy; + CustomerId.AssertNotEmpty(nameof(CustomerId)); + + try + { + devicePolicy = Partner.Customers[CustomerId].ConfigurationPolicies[PolicyId].Patch(configurationPolicy); + WriteObject(new PSConfigurationPolicy(devicePolicy)); + } + finally + { + devicePolicy = null; + } + } + + /// + /// Gets the specified policy from the specified customer from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the policy. + /// + /// is empty or null. + /// or + /// is empty or null. + /// + private ConfigurationPolicy GetCustomerPolicy(string customerId, string policyId) + { + customerId.AssertNotEmpty(nameof(customerId)); + policyId.AssertNotEmpty(nameof(policyId)); + + try + { + return Partner.Customers[customerId].ConfigurationPolicies[policyId].Get(); + } + finally + { } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerCustomerSubscription.cs b/src/PowerShell/Commands/SetPartnerCustomerSubscription.cs new file mode 100644 index 0000000..75ad91d --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerCustomerSubscription.cs @@ -0,0 +1,121 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Customers; + using Models.Subscriptions; + using PartnerCenter.Models.Subscriptions; + using Properties; + + [Cmdlet(VerbsCommon.Set, "PartnerCustomerSubscription", SupportsShouldProcess = true), OutputType(typeof(PSSubscription))] + public class SetPartnerCustomerSubscription : PartnerPSCmdlet + { + /// + /// Gets or sets a flag indiciating whether or not the subscription will auto renew. + /// + [Parameter(HelpMessage = "A flag indiciating whether or not the subscription will auto renew.", ParameterSetName = "Customer", Mandatory = false)] + [Parameter(HelpMessage = "A flag indiciating whether or not the subscription will auto renew.", ParameterSetName = "CustomerObject", Mandatory = false)] + public bool? AutoRenew { get; set; } + + /// + /// Gets or sets the customer object used to scope the request. + /// + [Parameter(HelpMessage = "The customer object used to scope the request.", ParameterSetName = "CustomerObject", Mandatory = true)] + public PSCustomer InputObject { get; set; } + + /// + /// Gets or sets the customer identifier. + /// + [Parameter(HelpMessage = "The identifier of the customer.", ParameterSetName = "Customer", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the friendly name of the subscription. + /// + [Parameter(HelpMessage = "The friendly name of the subscription.", ParameterSetName = "Customer", Mandatory = false)] + [Parameter(HelpMessage = "The friendly name of the sbuscription.", ParameterSetName = "CustomerObject", Mandatory = false)] + public string FriendlyName { get; set; } + + /// + /// Gets or sets the quantity. + /// + [Parameter(HelpMessage = "The quantity of the subscription.", ParameterSetName = "Customer", Mandatory = false)] + [Parameter(HelpMessage = "The quantity of the sbuscription.", ParameterSetName = "CustomerObject", Mandatory = false)] + public int? Quantity { get; set; } + + /// + /// Gets or sets the status of the subscription. + /// + [Parameter(HelpMessage = "The status of the subscription.", ParameterSetName = "Customer", Mandatory = false)] + [Parameter(HelpMessage = "The status of the subscription.", ParameterSetName = "CustomerObject", Mandatory = false)] + public SubscriptionStatus? Status { get; set; } + + /// + /// Gets or sets the subscriptions identifier. + /// + [Parameter(HelpMessage = "The identifier of the subscription.", ParameterSetName = "Customer", Mandatory = true)] + [Parameter(HelpMessage = "The identifier of the subscription.", ParameterSetName = "CustomerObject", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string SubscriptionId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Subscription subscription; + string customerId; + + try + { + customerId = (InputObject == null) ? CustomerId : InputObject.CustomerId; + + if (!ShouldProcess( + string.Format( + CultureInfo.CurrentCulture, Resources.SetPartnerCustomerSubscriptionWhatIf, SubscriptionId, + customerId))) + { + return; + } + + subscription = Partner.Customers[customerId].Subscriptions[SubscriptionId].Get(); + + if (AutoRenew.HasValue) + { + subscription.AutoRenewEnabled = AutoRenew.Value; + } + + if (!string.IsNullOrEmpty(FriendlyName)) + { + subscription.FriendlyName = FriendlyName; + } + + if (Quantity.HasValue) + { + subscription.Quantity = Quantity.Value; + } + + if (Status.HasValue) + { + subscription.Status = Status.Value; + } + + subscription = Partner.Customers[customerId].Subscriptions[SubscriptionId].Patch(subscription); + + WriteObject(new PSSubscription(subscription)); + } + finally + { + subscription = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerCustomerUser.cs b/src/PowerShell/Commands/SetPartnerCustomerUser.cs new file mode 100644 index 0000000..1d096c4 --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerCustomerUser.cs @@ -0,0 +1,193 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Security; + using System.Text.RegularExpressions; + using Common; + using Exceptions; + using Models.CustomerUsers; + using PartnerCenter.Exceptions; + using PartnerCenter.Models.Users; + using Properties; + + /// + /// Sets user information for a customer from Partner Center. + /// + [Cmdlet(VerbsCommon.Set, "PartnerCustomerUser", DefaultParameterSetName = "UserId", SupportsShouldProcess = true), OutputType(typeof(PSCustomerUser))] + public class SetPartnerCustomerUser : PartnerPSCmdlet + { + /// + /// Gets or sets the customer user being modified. + /// + [Parameter(Mandatory = true, ParameterSetName = "UserObject", ValueFromPipeline = true, HelpMessage = "The customer user object to be modified.")] + public PSCustomerUser InputObject { get; set; } + + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(Mandatory = true, ParameterSetName = "UserObject", Position = 0, HelpMessage = "The identifier for the customer.")] + [Parameter(Mandatory = true, ParameterSetName = "UserId", Position = 0, HelpMessage = "The identifier for the customer.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Gets or sets the required user identifier. + /// + [Parameter(Mandatory = true, ParameterSetName = "UserId", HelpMessage = "The identifier of the user.")] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string UserId { get; set; } + + /// + /// Gets or sets the optional user principal name. + /// + [Parameter(Mandatory = false, ParameterSetName = "UserObject", HelpMessage = "The user principal name.")] + [Parameter(Mandatory = false, ParameterSetName = "UserId", HelpMessage = "The user principal name.")] + public string UserPrincipalName { get; set; } + + /// + /// Sets the optional user first name. + /// + [Parameter(Mandatory = false, ParameterSetName = "UserObject", HelpMessage = "User's first name.")] + [Parameter(Mandatory = false, ParameterSetName = "UserId", HelpMessage = "User's first name.")] + public string FirstName { get; set; } + + /// + /// Sets the optional user last name. + /// + [Parameter(Mandatory = false, ParameterSetName = "UserObject", HelpMessage = "User's last name.")] + [Parameter(Mandatory = false, ParameterSetName = "UserId", HelpMessage = "User's last name.")] + public string LastName { get; set; } + + /// + /// Sets the optional user display name. + /// + [Parameter(Mandatory = false, ParameterSetName = "UserObject", HelpMessage = "User's display name.")] + [Parameter(Mandatory = false, ParameterSetName = "UserId", HelpMessage = "User's display name.")] + public string DisplayName { get; set; } + + /// + /// Sets the optional user display name. + /// + [Parameter(Mandatory = false, ParameterSetName = "UserObject", HelpMessage = "User's new password.")] + [Parameter(Mandatory = false, ParameterSetName = "UserId", HelpMessage = "User's new password.")] + public SecureString Password { get; set; } + + /// + /// Specifies whether user must change password on next login + /// + [Parameter(Mandatory = false, ParameterSetName = "UserObject", HelpMessage = "Forces user to change password during next login.")] + [Parameter(Mandatory = false, ParameterSetName = "UserId", HelpMessage = "Forces user to change password during next login.")] + public SwitchParameter ForceChangePasswordNextLogin { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CustomerUser user; + UserId = (InputObject == null) ? UserId : InputObject.UserId; + + // Get the current user information + user = GetUserById(CustomerId, UserId); + + try + { + if (user.Id == UserId) + { + // see what has changed for this user + if (UserPrincipalName != null) + { + user.UserPrincipalName = UserPrincipalName; + } + + if (FirstName != null) + { + user.FirstName = FirstName; + } + + if (LastName != null) + { + user.LastName = LastName; + } + + if (DisplayName != null) + { + user.DisplayName = DisplayName; + } + + PasswordProfile profile = null; + if (Password != null && Password.Length > 0) + { + string stringPassword = SecureStringExtensions.ConvertToString(Password); + profile = new PasswordProfile + { + Password = stringPassword, + ForceChangePassword = ForceChangePasswordNextLogin.IsPresent ? true : false + }; + user.PasswordProfile = profile; + } + else if (ForceChangePasswordNextLogin.IsPresent) + { + profile = new PasswordProfile + { + ForceChangePassword = ForceChangePasswordNextLogin.IsPresent ? true : false + }; + user.PasswordProfile = profile; + } + + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.SetPartnerCustomerUserWhatIf, UserId))) + { + if (InputObject == null && string.IsNullOrEmpty(UserId)) + { + throw new PSInvalidOperationException(Resources.InvalidSetCustomerUserIdentifierException); + } + + CustomerUser result = Partner.Customers[CustomerId].Users[UserId].Patch(user); + WriteObject(new PSCustomerUser(user), true); + } + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("An error was encountered when communicating with Partner Center.", ex); + } + finally + { + user = null; + } + } + + /// + /// Gets a details for a specified user and customer from Partner Center. + /// + /// Identifier of the customer. + /// Identifier of the user. + /// + /// is empty or null. + /// + private CustomerUser GetUserById(string customerId, string userId) + { + CustomerUser user; + + customerId.AssertNotEmpty(nameof(customerId)); + userId.AssertNotEmpty(nameof(userId)); + + try + { + user = Partner.Customers[customerId].Users[userId].Get(); + return user; + } + finally + { + user = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerLegalProfile.cs b/src/PowerShell/Commands/SetPartnerLegalProfile.cs new file mode 100644 index 0000000..f1f4740 --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerLegalProfile.cs @@ -0,0 +1,165 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Exceptions; + using Models.Partners; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.Partners; + using Properties; + using Validations; + + /// + /// Sets the partner legal profile in Partner Center. + /// + [Cmdlet(VerbsCommon.Set, "PartnerLegalProfile", SupportsShouldProcess = true), OutputType(typeof(PSLegalBusinessProfile))] + public class SetPartnerLegalProfile : PartnerPSCmdlet + { + /// + /// Gets or sets the first line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The first line of the address.")] + [ValidateNotNullOrEmpty] + public string AddressLine1 { get; set; } + + /// + /// Gets or sets the second line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The second line of the adress.")] + [ValidateNotNullOrEmpty] + public string AddressLine2 { get; set; } + + /// + /// Gets or sets the city portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The city portion of the address.")] + [ValidateNotNullOrEmpty] + public string City { get; set; } + + /// + /// Gets or sets the country portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The country portion of the address.")] + [ValidateNotNullOrEmpty] + public string Country { get; set; } + + /// + /// Gets or sets the email address of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The email address of the primary billing contact.")] + [ValidatePattern(@"^(?("")("".+?(? + /// Gets or sets the first name of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The first name of the primary billing contact.")] + [ValidateNotNullOrEmpty] + public string FirstName { get; set; } + + /// + /// Gets or sets the last name of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The last name of the primary billing contact.")] + [ValidateNotNullOrEmpty] + public string LastName { get; set; } + + /// + /// Gets or sets the phone number of the primary billing contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The phone number of the primary billing contact.")] + [ValidateNotNullOrEmpty] + public string PhoneNumber { get; set; } + + /// + /// Gets or sets the postal code portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The postal code portion of the address.")] + [ValidateNotNullOrEmpty] + public string PostalCode { get; set; } + + /// + /// Gets or sets the region portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The region portion of the address.")] + [ValidateNotNullOrEmpty] + public string Region { get; set; } + + /// + /// Gets or sets the state portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The state portion of the address.")] + [ValidateNotNullOrEmpty] + public string State { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + IValidator
validator; + LegalBusinessProfile profile; + + try + { + if (ShouldProcess(Resources.SetPartnerLegalProfileWhatIf)) + { + profile = Partner.Profiles.LegalBusinessProfile.Get(); + + profile.Address.AddressLine1 = UpdateValue(AddressLine1, profile.Address.AddressLine1); + profile.Address.AddressLine2 = UpdateValue(AddressLine2, profile.Address.AddressLine2); + profile.Address.City = UpdateValue(City, profile.Address.City); + profile.Address.Country = UpdateValue(Country, profile.Address.Country); + profile.Address.PostalCode = UpdateValue(PostalCode, profile.Address.PostalCode); + profile.Address.Region = UpdateValue(Region, profile.Address.Region); + profile.Address.State = UpdateValue(State, profile.Address.State); + profile.CompanyApproverAddress = profile.Address; + profile.CompanyApproverEmail = UpdateValue(EmailAddress, profile.CompanyApproverEmail); + + try + { + validator = new AddressValidator(Partner); + + if (!validator.IsValid(profile.Address)) + { + throw new PSInvalidOperationException("The specified address is invalid. Please verify the address and try again."); + } + } + catch (PartnerException ex) + { + throw new PSPartnerException("The specified address is invalid. Please verify the address and try again.", ex); + } + + profile = Partner.Profiles.LegalBusinessProfile.Update(profile); + + WriteObject(new PSLegalBusinessProfile(profile)); + } + } + finally + { + profile = null; + validator = null; + } + } + + private static string UpdateValue(string input, string output) + { + string newValue = output; + + if (!string.IsNullOrEmpty(input) && !input.Equals(output, StringComparison.OrdinalIgnoreCase)) + { + newValue = input; + } + + return newValue; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerOrganizationProfile.cs b/src/PowerShell/Commands/SetPartnerOrganizationProfile.cs new file mode 100644 index 0000000..232dae1 --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerOrganizationProfile.cs @@ -0,0 +1,170 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Partners; + using PartnerCenter.Models; + using PartnerCenter.Models.Partners; + using Validations; + + /// + /// Sets the partner organization profile in Partner Center. + /// + [Cmdlet(VerbsCommon.Set, "PartnerOrganizationProfile", SupportsShouldProcess = true), OutputType(typeof(PSOrganizationProfile))] + public class SetPartnerOrganizationProfile : PartnerPSCmdlet + { + /// + /// Gets or sets the company name. + /// + [Parameter(Mandatory = false, HelpMessage = "The company name.")] + [ValidateNotNullOrEmpty] + public string CompanyName { get; set; } + + /// + /// Gets or sets the first line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The first line of the address.")] + [ValidateNotNullOrEmpty] + public string AddressLine1 { get; set; } + + /// + /// Gets or sets the second line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The second line of the address.")] + [ValidateNotNullOrEmpty] + public string AddressLine2 { get; set; } + + /// + /// Gets or sets the city portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The city portion of the address.")] + [ValidateNotNullOrEmpty] + public string City { get; set; } + + /// + /// Gets or sets the country portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The country portion of the address.")] + [ValidateNotNullOrEmpty] + public string Country { get; set; } + + /// + /// Gets or sets the preferred culture of the organization. + /// + [Parameter(Mandatory = false, HelpMessage = "The preferred organization culture.")] + [ValidateNotNullOrEmpty] + public string Culture { get; set; } + + /// + /// Gets or sets the email address of the organization contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The organization technical contact's email address.")] + [ValidatePattern(@"^(?("")("".+?(? + /// Gets or sets the first name of the primary organization contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The primary organization contact's first name.")] + [ValidateNotNullOrEmpty] + public string FirstName { get; set; } + + /// + /// Gets or sets the preferred language of the organization. + /// + [Parameter(Mandatory = false, HelpMessage = "The primary organization language.")] + [ValidateNotNullOrEmpty] + public string Language { get; set; } + + /// + /// Gets or sets the last name of the primary organization contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The primary organization contact's last name.")] + [ValidateNotNullOrEmpty] + public string LastName { get; set; } + + /// + /// Gets or sets the phone number of the primary organization contact. + /// + [Parameter(Mandatory = false, HelpMessage = "The primary organization contact's phone number.")] + [ValidateNotNullOrEmpty] + public string PhoneNumber { get; set; } + + /// + /// Gets or sets the postal code portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The postal code of the address.")] + [ValidateNotNullOrEmpty] + public string PostalCode { get; set; } + + /// + /// Gets or sets the state portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The state portion of the address.")] + [ValidateNotNullOrEmpty] + public string State { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + OrganizationProfile profile; + IValidator
validator; + + try + { + if (ShouldProcess("Updates the partner's organization profile")) + { + profile = Partner.Profiles.OrganizationProfile.Get(); + + profile.CompanyName = UpdateValue(CompanyName, profile.CompanyName); + profile.Email = UpdateValue(Email, profile.Email); + profile.Language = UpdateValue(Language, profile.Language); + profile.Culture = UpdateValue(Culture, profile.Culture); + + profile.DefaultAddress.AddressLine1 = UpdateValue(AddressLine1, profile.DefaultAddress.AddressLine1); + profile.DefaultAddress.AddressLine2 = UpdateValue(AddressLine2, profile.DefaultAddress.AddressLine2); + profile.DefaultAddress.City = UpdateValue(City, profile.DefaultAddress.City); + profile.DefaultAddress.Country = UpdateValue(Country, profile.DefaultAddress.Country); + profile.DefaultAddress.PostalCode = UpdateValue(PostalCode, profile.DefaultAddress.PostalCode); + profile.DefaultAddress.State = UpdateValue(State, profile.DefaultAddress.State); + profile.DefaultAddress.FirstName = UpdateValue(FirstName, profile.DefaultAddress.FirstName); + profile.DefaultAddress.LastName = UpdateValue(LastName, profile.DefaultAddress.LastName); + profile.DefaultAddress.PhoneNumber = UpdateValue(PhoneNumber, profile.DefaultAddress.PhoneNumber); + + validator = new AddressValidator(Partner); + + if (validator.IsValid(profile.DefaultAddress)) + { + profile = Partner.Profiles.OrganizationProfile.Update(profile); + WriteObject(new PSOrganizationProfile(profile)); + } + } + } + finally + { + profile = null; + } + } + + private static string UpdateValue(string input, string output) + { + string newValue = output; + + if (!string.IsNullOrEmpty(input) && !input.Equals(output, StringComparison.OrdinalIgnoreCase)) + { + newValue = input; + } + + return newValue; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/SetPartnerSupportProfile.cs b/src/PowerShell/Commands/SetPartnerSupportProfile.cs new file mode 100644 index 0000000..8f00395 --- /dev/null +++ b/src/PowerShell/Commands/SetPartnerSupportProfile.cs @@ -0,0 +1,79 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Partners; + using PartnerCenter.Models.Partners; + + /// + /// Sets the partner support profile in Partner Center. + /// + [Cmdlet(VerbsCommon.Set, "PartnerSupportProfile", SupportsShouldProcess = true), OutputType(typeof(PSSupportProfile))] + public class SetPartnerSupportProfile : PartnerPSCmdlet + { + /// + /// Gets or sets the email address of the support contact. + /// + [Parameter(HelpMessage = "The email address of the support contact.", Mandatory = false)] + [ValidatePattern(@"^(?("")("".+?(? + /// Gets or sets the phone number of the support contact. + /// + [Parameter(HelpMessage = "The phone number of the support contact.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string SupportPhoneNumber { get; set; } + + /// + /// Gets or sets the website where customers can get support. + /// + [Parameter(HelpMessage = "The website where customers can get support.", Mandatory = false)] + [ValidateNotNullOrEmpty] + public string SupportWebsite { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + SupportProfile profile; + + try + { + profile = Partner.Profiles.SupportProfile.Get(); + + profile.Email = UpdateValue(SupportEmail, profile.Email); + profile.Telephone = UpdateValue(SupportPhoneNumber, profile.Telephone); + profile.Website = UpdateValue(SupportWebsite, profile.Website); + + profile = Partner.Profiles.SupportProfile.Update(profile); + + WriteObject(new PSSupportProfile(profile)); + } + finally + { + profile = null; + } + } + + private static string UpdateValue(string input, string output) + { + string newValue = output; + + if (!string.IsNullOrEmpty(input) && !input.Equals(output, StringComparison.OrdinalIgnoreCase)) + { + newValue = input; + } + + return newValue; + } + } +} diff --git a/src/PowerShell/Commands/SubmitPartnerCustomerCart.cs b/src/PowerShell/Commands/SubmitPartnerCustomerCart.cs new file mode 100644 index 0000000..78caec6 --- /dev/null +++ b/src/PowerShell/Commands/SubmitPartnerCustomerCart.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Globalization; + using System.Management.Automation; + using System.Text.RegularExpressions; + using Models.Carts; + using PartnerCenter.Carts; + using Properties; + + /// + /// Checks out the specified cart. + /// + [Cmdlet(VerbsLifecycle.Submit, "PartnerCustomerCart", SupportsShouldProcess = true), OutputType(typeof(PSCartCheckoutResult))] + public class SubmitPartnerCustomerCart : PartnerPSCmdlet + { + /// + /// Gets or sets the required cart identifier. + /// + [Parameter(HelpMessage = "The identifier for the cart.", Mandatory = true)] + [ValidateNotNull] + public string CartId { get; set; } + + /// + /// Gets or sets the required customer identifier. + /// + [Parameter(HelpMessage = "The identifier for the customer.", Mandatory = true)] + [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] + public string CustomerId { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + CartCheckoutResult checkoutResult; + + try + { + if (ShouldProcess(string.Format(CultureInfo.CurrentCulture, Resources.CheckoutPartnerCustomerCartWhatIf, CartId))) + { + checkoutResult = Partner.Customers[CustomerId].Carts[CartId].Checkout(); + WriteObject(new PSCartCheckoutResult(checkoutResult)); + } + } + finally + { + checkoutResult = null; + } + } + } +} diff --git a/src/PowerShell/Commands/TestPartnerAddress.cs b/src/PowerShell/Commands/TestPartnerAddress.cs new file mode 100644 index 0000000..7f24cf2 --- /dev/null +++ b/src/PowerShell/Commands/TestPartnerAddress.cs @@ -0,0 +1,99 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Microsoft.Store.PartnerCenter.PowerShell.Validations; + using PartnerCenter.Models; + + /// + /// Verifies the specified is valid. + /// + [Cmdlet(VerbsDiagnostic.Test, "PartnerAddress", SupportsShouldProcess = true), OutputType(typeof(bool))] + public class TestPartnerAddress : PartnerPSCmdlet + { + /// + /// Gets or sets the first line of the address. + /// + [Parameter(Mandatory = true, HelpMessage = "The first line of the address.")] + [ValidateNotNullOrEmpty] + public string AddressLine1 { get; set; } + + /// + /// Gets or sets the second line of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The second line of the adress.")] + [ValidateNotNullOrEmpty] + public string AddressLine2 { get; set; } + + /// + /// Gets or sets the city portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The city portion of the address.")] + [ValidateNotNullOrEmpty] + public string City { get; set; } + + /// + /// Gets or sets the country portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The country portion of the address.")] + [ValidateNotNullOrEmpty] + public string Country { get; set; } + + /// + /// Gets or sets the postal code portion of the address. + /// + [Parameter(Mandatory = true, HelpMessage = "The postal code portion of the address.")] + [ValidateNotNullOrEmpty] + public string PostalCode { get; set; } + + /// + /// Gets or sets the region portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The region portion of the address.")] + [ValidateNotNullOrEmpty] + public string Region { get; set; } + + /// + /// Gets or sets the state portion of the address. + /// + [Parameter(Mandatory = false, HelpMessage = "The state portion of the address.")] + [ValidateNotNullOrEmpty] + public string State { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() + { + Address address; + IValidator
validator; + + try + { + address = new Address + { + AddressLine1 = AddressLine1, + AddressLine2 = AddressLine2, + City = City, + Country = Country, + PostalCode = PostalCode, + Region = Region, + State = State + }; + + validator = new AddressValidator(Partner); + + WriteObject(validator.IsValid(address)); + } + finally + { + address = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Commands/TestPartnerDomainAvailability.cs b/src/PowerShell/Commands/TestPartnerDomainAvailability.cs new file mode 100644 index 0000000..89c1a9e --- /dev/null +++ b/src/PowerShell/Commands/TestPartnerDomainAvailability.cs @@ -0,0 +1,47 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Commands +{ + using System.Management.Automation; + using Common; + + /// + /// Check to see if the specified domain name is available. + /// + [Cmdlet(VerbsDiagnostic.Test, "PartnerDomainAvailability"), OutputType(typeof(bool))] + public class TestPartnerDomainAvailability : PartnerPSCmdlet + { + /// + /// Test if the specified domain name is available. + /// + [Parameter(HelpMessage = "A string that identifies the domain to check, e.g. \"contoso.onmicrosoft.com\" .", Mandatory = true, Position = 0)] + [ValidateNotNullOrEmpty] + public string Domain { get; set; } + + /// + /// Executes the operations associated with the cmdlet. + /// + public override void ExecuteCmdlet() { TestDomainAvailability(Domain); } + + /// + /// Checks if domain name is available. + /// + /// Domain to test. + /// + /// is empty or null. + /// + private void TestDomainAvailability(string domain) + { + bool domainExists; + + domain.AssertNotEmpty(nameof(domain)); + + domainExists = Partner.Domains.ByDomain(domain).Exists(); + WriteObject(!domainExists); + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Common/AssertExtensions.cs b/src/PowerShell/Common/AssertExtensions.cs new file mode 100644 index 0000000..b5c034f --- /dev/null +++ b/src/PowerShell/Common/AssertExtensions.cs @@ -0,0 +1,70 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Common +{ + using System; + using System.Globalization; + using Properties; + + /// + /// Groups useful extension methods used for validation. + /// + public static class AssertExtensions + { + /// + /// Ensures that a given object is not null. Throws an exception otherwise. + /// + /// The object we are validating. + /// The name to report in the exception. + public static void AssertNotNull(this object objectToValidate, string caption) + { + if (objectToValidate == null) + { + throw new ArgumentNullException(caption); + } + } + + /// + /// Ensures that a string is not empty. Throws an exception if so. + /// + /// The string to validate. + /// The name to report in the exception. + public static void AssertNotEmpty(this string nonEmptyString, string caption) + { + if (string.IsNullOrWhiteSpace(nonEmptyString)) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.AssertStringNotEmptyInvalidError, caption ?? Resources.AssertStringNotEmptyInvalidPrefix)); + } + } + + /// + /// Ensures that a given number is greater than zero. Throws an exception otherwise. + /// + /// The number to validate. + /// The name to report in the exception. + public static void AssertPositive(this int number, string caption) + { + if (number <= 0) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.AssertNumberPositiveInvalidError, caption ?? Resources.AssertNumberPositiveInvalidPrefix)); + } + } + + /// + /// Ensures that a given number is greater than zero. Throws an exception otherwise. + /// + /// The number to validate. + /// The name to report in the exception. + public static void AssertPositive(this decimal number, string caption) + { + if (number <= 0) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.AssertNumberPositiveInvalidError, caption ?? Resources.AssertNumberPositiveInvalidPrefix)); + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Common/PSPartnerException.cs b/src/PowerShell/Common/PSPartnerException.cs new file mode 100644 index 0000000..8df8908 --- /dev/null +++ b/src/PowerShell/Common/PSPartnerException.cs @@ -0,0 +1,93 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Exceptions +{ + using System; + using System.ComponentModel; + using System.Management.Automation; + using System.Reflection; + using System.Runtime.Serialization; + using PartnerCenter.Exceptions; + + [Serializable] + public class PSPartnerException : PSInvalidOperationException + { + /// + /// Initializes a new instance of the class. + /// + public PSPartnerException() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The message that describes the error. + public PSPartnerException(string message) : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. + /// + public PSPartnerException(string message, Exception innerException) : base(GetApiError(message, innerException), innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + protected PSPartnerException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + + private static string GetApiError(string message, Exception innerException) + { + PartnerException ex = (PartnerException)innerException; + ApiError error = (ApiError)Enum.Parse(typeof(ApiError), ex.ServiceErrorPayload.ErrorCode); + return string.IsNullOrEmpty(message) ? "ErrorCode : " + ex.ServiceErrorPayload.ErrorCode + " - " + GetEnumDescription(error) : message + " - ErrorCode: " + ex.ServiceErrorPayload.ErrorCode + " - " + GetEnumDescription(error); + } + + public enum ApiError + { + [Description("Unknown error")] + Unknown = 0, + [Description("Product was not found")] + ProductNotFound = 400013, + [Description("Sku was not found")] + SkuNotFound = 400018, + [Description("A required inventory context item is missing")] + InventoryContextMissing = 400026, + [Description("Access to the requested segment is not allowed")] + SegmentNotAllowed = 400030, + [Description("Access to the requested catalog is not allowed")] + CatalogNotAllowed = 400036 + } + + public static string GetEnumDescription(Enum value) + { + FieldInfo fi = value.GetType().GetField(value.ToString()); + + DescriptionAttribute[] attributes = + (DescriptionAttribute[])fi.GetCustomAttributes( + typeof(DescriptionAttribute), + false); + + if (attributes != null && + attributes.Length > 0) + return attributes[0].Description; + else + return value.ToString(); + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Common/ResourceExtensions.cs b/src/PowerShell/Common/ResourceExtensions.cs new file mode 100644 index 0000000..ffa133c --- /dev/null +++ b/src/PowerShell/Common/ResourceExtensions.cs @@ -0,0 +1,126 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Common +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Reflection; + using Models.Orders; + using Models.Utilizations; + using PartnerCenter.Models.Orders; + using PartnerCenter.Models.Utilizations; + + /// + /// Useful extension for performing conversions. + /// + internal static class ResourceExtensions + { + public static void CopyFrom(this TOutput value, TInput other) + where TInput : class + where TOutput : class, new() + { + if (value != null && other != null) + { + CloneProperties(value, other); + } + } + + public static void CopyFrom(this TOutput value, TInput other, Action operation) + where TInput : class + where TOutput : class, new() + { + if (value != null && other != null) + { + CloneProperties(value, other); + operation.Invoke(other); + } + } + + /// + /// Copies the values from an instance of . + /// + /// An instance of the class. + /// The base Azure utilization record that should be cloned. + public static void CopyFrom(this PSAzureUtilizationRecord azureUtilizationRecord, AzureUtilizationRecord other) + { + if (azureUtilizationRecord != null && other != null) + { + CloneProperties(azureUtilizationRecord, other); + + azureUtilizationRecord.AdditionalInfo = other.InstanceData.AdditionalInfo; + azureUtilizationRecord.InfoFields = other.InfoFields; + azureUtilizationRecord.Tags = other.InstanceData.Tags; + + azureUtilizationRecord.CopyFrom(other.InstanceData); + azureUtilizationRecord.CopyFrom(other.Resource); + } + } + + #region Orders + + /// + /// Copies the values from an instance of . + /// + /// An instance of the class. + /// The base order line item whose properties should be copied. + public static void CopyFrom(this PSOrderLineItem orderLineItem, OrderLineItem other) + { + if (orderLineItem != null && other != null) + { + CloneProperties(orderLineItem, other); + + if (other.ProvisioningContext != null) + { + foreach (KeyValuePair item in other.ProvisioningContext) + orderLineItem.ProvisioningContext.Add(item.Key, item.Value); + + } + } + } + + /// + /// Converts an instance of to an instance of . + /// + /// An instance the class that represents purcharse data for an offer. + /// An instance of the that represents purchase data for an offer. + public static OrderLineItem ToOrderLineItem(this PSOrderLineItem orderLineItem) => new OrderLineItem + { + FriendlyName = orderLineItem.FriendlyName, + LineItemNumber = orderLineItem.LineItemNumber, + OfferId = orderLineItem.OfferId, + ParentSubscriptionId = orderLineItem.ParentSubscriptionId, + PartnerIdOnRecord = orderLineItem.PartnerIdOnRecord, + ProvisioningContext = orderLineItem.ProvisioningContext, + Quantity = orderLineItem.Quantity, + SubscriptionId = orderLineItem.SubscriptionId + }; + + #endregion + + /// + /// Clones the properties from the input to the output. + /// + /// + /// + /// + /// + private static void CloneProperties(TOutput output, TInput input) where TOutput : class, new() + { + foreach (PropertyInfo prop in output.GetType().GetRuntimeProperties()) + { + if (input.GetType().GetRuntimeProperty(prop.Name) != null && prop.CanWrite) + { + if (!typeof(ICollection).IsAssignableFrom(prop.PropertyType)) + { + prop.SetValue(output, input.GetType().GetRuntimeProperty(prop.Name).GetValue(input)); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Common/SecureStringExtensions.cs b/src/PowerShell/Common/SecureStringExtensions.cs new file mode 100644 index 0000000..ab1fa4b --- /dev/null +++ b/src/PowerShell/Common/SecureStringExtensions.cs @@ -0,0 +1,39 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Common +{ + using System; + using System.Runtime.InteropServices; + using System.Security; + + /// + /// Extends SecureString and string to all conversion. + /// + public static class SecureStringExtensions + { + /// + /// Converts a secure string to a regular string. + /// + /// Specifies the secure string to convert. + /// The string that was converted from a secure string + public static string ConvertToString(this SecureString secureString) + { + secureString.AssertNotNull(nameof(secureString)); + + IntPtr stringPtr = IntPtr.Zero; + try + { + stringPtr = Marshal.SecureStringToBSTR(secureString); + return Marshal.PtrToStringBSTR(stringPtr); + } + finally + { + Marshal.ZeroFreeBSTR(stringPtr); + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Converts/CustomerConverter.cs b/src/PowerShell/Converts/CustomerConverter.cs new file mode 100644 index 0000000..99345ba --- /dev/null +++ b/src/PowerShell/Converts/CustomerConverter.cs @@ -0,0 +1,60 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Converts +{ + using System; + using System.Collections.Generic; + using Commands; + using PartnerCenter.Models.Customers; + + public class CustomerConverter + { + private readonly Dictionary, Action> mappings; + + public CustomerConverter(SetPartnerCustomer setPSCustomer, Customer customer) + { + mappings = new Dictionary, Action> + { + { + () => setPSCustomer.BillingAddressCity, c => customer.BillingProfile.DefaultAddress.City = c + }, + { + () => setPSCustomer.BillingAddressLine1, c => customer.BillingProfile.DefaultAddress.AddressLine1 = c + }, + { + () => setPSCustomer.BillingAddressLine2, c => customer.BillingProfile.DefaultAddress.AddressLine2 = c + }, + { + () => setPSCustomer.BillingAddressCountry, c => customer.BillingProfile.DefaultAddress.Country = c + }, + { + () => setPSCustomer.BillingAddressPostalCode, c => customer.BillingProfile.DefaultAddress.PostalCode = c + }, + { + () => setPSCustomer.BillingAddressRegion, c => customer.BillingProfile.DefaultAddress.Region = c + }, + { + () => setPSCustomer.BillingAddressState, c => customer.BillingProfile.DefaultAddress.State = c + }, + { + () => setPSCustomer.Name, c => customer.BillingProfile.CompanyName = c + } + }; + } + + public void Convert() + { + foreach (KeyValuePair, Action> element in mappings) + { + if (!string.IsNullOrEmpty(element.Key.Invoke())) + { + element.Value(element.Key.Invoke()); + } + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Factories/AuthenticationFactory.cs b/src/PowerShell/Factories/AuthenticationFactory.cs new file mode 100644 index 0000000..ed124b8 --- /dev/null +++ b/src/PowerShell/Factories/AuthenticationFactory.cs @@ -0,0 +1,127 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Factories +{ + using System; + using System.Security; + using Authentication; + using Common; + using IdentityModel.Clients.ActiveDirectory; + using PartnerCenter.Models.Partners; + + /// + /// Factory that handles authenticaton operations. + /// + public class AuthenticationFactory : IAuthenticationFactory + { + public PartnerContext Authenticate(string applicationId, EnvironmentName environment, string username, SecureString password, string tenantId) + { + AuthenticationResult authResult; + IPartner partner; + OrganizationProfile profile; + PartnerContext context; + + applicationId.AssertNotEmpty(nameof(applicationId)); + environment.AssertNotNull(nameof(environment)); + tenantId.AssertNotEmpty(nameof(tenantId)); + + try + { + context = new PartnerContext + { + ApplicationId = applicationId, + Environment = environment, + TenantId = tenantId, + Username = username + }; + + authResult = Authenticate(context, password); + + partner = PartnerSession.Instance.ClientFactory.CreatePartnerOperations(context); + profile = partner.Profiles.OrganizationProfile.Get(); + + context.CountryCode = profile.DefaultAddress.Country; + context.Locale = profile.Culture; + context.UserId = authResult.UserInfo.UniqueId; + + return context; + } + finally + { + authResult = null; + partner = null; + profile = null; + } + } + + /// + /// Authenticates the user using the specified parameters. + /// + /// The partner's execution context. + /// The password used to authenicate the user. This value can be null. + /// The result from the authentication request. + /// + /// is null. + /// + public AuthenticationResult Authenticate(PartnerContext context, SecureString password) + { + AuthenticationContext authContext; + AuthenticationResult authResult; + PartnerEnvironment environment; + + context.AssertNotNull(nameof(context)); + + try + { + environment = PartnerEnvironment.PublicEnvironments[context.Environment]; + + authContext = new AuthenticationContext($"{environment.ActiveDirectoryAuthority}{context.TenantId}"); + + if (string.IsNullOrEmpty(context.Username)) + { + authResult = authContext.AcquireToken( + environment.PartnerCenterEndpoint, + context.ApplicationId, + new Uri("urn:ietf:wg:oauth:2.0:oob"), + PromptBehavior.Always, + UserIdentifier.AnyUser); + + context.TenantId = authResult.TenantId; + context.Username = authResult.UserInfo.DisplayableId; + } + else if (password != null) + { + authResult = authContext.AcquireToken( + environment.PartnerCenterEndpoint, + context.ApplicationId, + new UserCredential( + context.Username, + password)); + + context.TenantId = authResult.TenantId; + context.Username = authResult.UserInfo.DisplayableId; + } + else + { + authResult = authContext.AcquireToken( + environment.PartnerCenterEndpoint, + context.ApplicationId, + new Uri("urn:ietf:wg:oauth:2.0:oob"), + PromptBehavior.Never, + new UserIdentifier(context.Username, UserIdentifierType.RequiredDisplayableId)); + } + + return authResult; + } + finally + { + authContext = null; + environment = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Factories/ClientFactory.cs b/src/PowerShell/Factories/ClientFactory.cs new file mode 100644 index 0000000..4077685 --- /dev/null +++ b/src/PowerShell/Factories/ClientFactory.cs @@ -0,0 +1,53 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Factories +{ + using Authentication; + using Common; + using Extensions; + using IdentityModel.Clients.ActiveDirectory; + + /// + /// Factory that provides initialized clients used to interact with online services. + /// + public class ClientFactory : IClientFactory + { + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + /// + /// is null. + /// + public virtual IPartner CreatePartnerOperations(PartnerContext context) + { + AuthenticationResult authResult; + + context.AssertNotNull(nameof(context)); + + try + { + authResult = PartnerSession.Instance.AuthenticationFactory.Authenticate( + context, + null); + + IPartnerCredentials credentials = PartnerCredentials.Instance.GenerateByUserCredentials( + context.ApplicationId, + new AuthenticationToken(authResult.AccessToken, authResult.ExpiresOn)); + + PartnerService.Instance.ApplicationName = "Partner Center PowerShell (Preview)"; + + return PartnerService.Instance.CreatePartnerOperations(credentials); + } + finally + { + authResult = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Factories/IAuthenticationFactory.cs b/src/PowerShell/Factories/IAuthenticationFactory.cs new file mode 100644 index 0000000..925837b --- /dev/null +++ b/src/PowerShell/Factories/IAuthenticationFactory.cs @@ -0,0 +1,28 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Factories +{ + using System.Security; + using Authentication; + using IdentityModel.Clients.ActiveDirectory; + + /// + /// Represents a factory that handles authentication operations. + /// + public interface IAuthenticationFactory + { + PartnerContext Authenticate(string applicationId, EnvironmentName environment, string username, SecureString password, string tenantId); + + /// + /// Authenticates the user using the specified parameters. + /// + /// Partner and user details used by the Partner Center cmdlets. + /// The password used to authenicate the user. This value can be null. + /// The result from the authentication request. + AuthenticationResult Authenticate(PartnerContext context, SecureString password); + } +} \ No newline at end of file diff --git a/src/PowerShell/Factories/IClientFactory.cs b/src/PowerShell/Factories/IClientFactory.cs new file mode 100644 index 0000000..f4ec954 --- /dev/null +++ b/src/PowerShell/Factories/IClientFactory.cs @@ -0,0 +1,24 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Factories +{ + using Authentication; + + /// + /// Represents a factory that provides initialized clients used to interact with online services. + /// + public interface IClientFactory + { + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + IPartner CreatePartnerOperations(PartnerContext context); + + } +} \ No newline at end of file diff --git a/src/PowerShell/GlobalSuppressions.cs b/src/PowerShell/GlobalSuppressions.cs new file mode 100644 index 0000000..8ecefed --- /dev/null +++ b/src/PowerShell/GlobalSuppressions.cs @@ -0,0 +1,12 @@ + +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Property used as part of a PowerShell cmdlet", Scope = "member", Target = "~P:Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomerOrderLineItem.ProvisioningContext")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "Property used as part of a PowerShell cmdlet", Scope = "member", Target = "~P:Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomerOrder.LineItems")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "Property used as part of a PowerShell cmdlet", Scope = "member", Target = "~P:Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomerCart.LineItems")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Property used as part of a PowerShell cmdlet", Scope = "member", Target = "~P:Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomerCartLineItem.ProvisioningContext")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Property used as part of a PowerShell cmdlet", Scope = "member", Target = "~P:Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerProductInventory.Variables")] + diff --git a/src/PowerShell/Microsoft.Store.PartnerCenter.PowerShell.format.ps1xml b/src/PowerShell/Microsoft.Store.PartnerCenter.PowerShell.format.ps1xml new file mode 100644 index 0000000..bdb011e --- /dev/null +++ b/src/PowerShell/Microsoft.Store.PartnerCenter.PowerShell.format.ps1xml @@ -0,0 +1,476 @@ + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + + Microsoft.Store.PartnerCenter.PowerShell.Models.Customers.PSCustomer + + + + + + + + + + + + + + + + + + CustomerId + + + Domain + + + Name + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices.PSInvoice + + Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices.PSInvoice + + + + + + + + + + + + + + + + + + + + + + + + InvoiceId + + + InvoiceType + + + InvoiceDate + + + TotalCharges + + + PaidAmount + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Offers.PSOffer + + Microsoft.Store.PartnerCenter.PowerShell.Models.Offers.PSOffer + + + + + + + + OfferId + + + + Name + + + + Billing + + + + MaximumQuantity + + + + SupportedBillingCycles + + + + IsAddOn + + + + IsTrial + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProductAvailability + + Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProductAvailability + + + + + + + + AvailabilityId + + + + ProductId + + + + SkuId + + + + CatalogItemId + + + + DefaultCurrencyCode + + + + DefaultCurrencySymbol + + + + Segment + + + + Country + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Utilizations.PSAzureUtilizationRecord + + Microsoft.Store.PartnerCenter.PowerShell.Models.Utilizations.PSAzureUtilizationRecord + + + + + + + + + + + + + + + + + + + + + + + + UsageStartTime + + + UsageEndTime + + + Name + + + Quantity + + + Id + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment.PSDeviceBatch + + Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment.PSDeviceBatch + + + + + + + + + + + + + + + + + + BatchId + + + DevicesCount + + + DevicesCount + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment.PSDevice + + Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment.PSDevice + + + + + + + + + + + + + + + + + + + + + + + + + + + DeviceId + + + SerialNumber + + + ProductKey + + + ModelName + + + OemManufacturerName + + + UploadedDate + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProduct + + Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProduct + + + + + + + + + + + + + + 20 + + + + + + + + ProductId + + + Title + + + Type + + + Description + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProduct + + Microsoft.Store.PartnerCenter.PowerShell.Models.Products.PSProduct + + + + + + + + ProductId + + + + Title + + + + Type + + + + Description + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + + Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + + + + + + + + + + + 20 + + + + + + + + + + + + + + + + + + + + UserId + + + DisplayName + + + UserPrincipalName + + + FirstName + + + LastName + + + UserDomainType + + + State + + + + + + + + Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + + Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers.PSCustomerUser + + + + + + + + UserId + + + + DisplayName + + + + UserPrincipalName + + + + FirstName + + + + LastName + + + + UserDomainType + + + + State + + + + + + + + \ No newline at end of file diff --git a/src/PowerShell/Models/Agreements/PSAgreement.cs b/src/PowerShell/Models/Agreements/PSAgreement.cs new file mode 100644 index 0000000..9327653 --- /dev/null +++ b/src/PowerShell/Models/Agreements/PSAgreement.cs @@ -0,0 +1,63 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Agreements +{ + using System; + using Common; + using PartnerCenter.Models.Agreements; + + /// + /// The class represents an agreement object. + /// + public sealed class PSAgreement + { + /// + /// Initializes a new instance of the class. + /// + public PSAgreement() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base agreement for this instance. + public PSAgreement(Agreement agreement) + { + this.CopyFrom(agreement); + } + + /// + /// Gets or sets the download link for the agreement. + /// + public Uri AgreementLink { get; set; } + + /// + /// Gets or sets the date the agreement was signed. + /// + public DateTime DateAgreed { get; set; } + + /// + /// Gets or sets the primary contact for the agreement. + /// + public Contact PrimaryContact { get; set; } + + /// + /// Gets or sets the template identifier of the agreement. + /// + public string TemplateId { get; set; } + + /// + /// Gets or sets the agreement type. + /// + public AgreementType Type { get; set; } + + /// + /// Gets or sets the partner's user identifier. + /// + public string UserId { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Agreements/PSAgreementMetaData.cs b/src/PowerShell/Models/Agreements/PSAgreementMetaData.cs new file mode 100644 index 0000000..c0215e8 --- /dev/null +++ b/src/PowerShell/Models/Agreements/PSAgreementMetaData.cs @@ -0,0 +1,53 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Agreements +{ + using System; + using Common; + using PartnerCenter.Models.Agreements; + + /// + /// This class represents the meta data about agreements. + /// + public sealed class PSAgreementMetaData + { + /// + /// Initializes a new instance of the class. + /// + public PSAgreementMetaData() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base agreement meta data for this instance. + public PSAgreementMetaData(AgreementMetaData agreementMetaData) + { + this.CopyFrom(agreementMetaData); + } + + /// + /// Gets or sets the download link for the agreement. + /// + public Uri AgreementLink { get; set; } + + /// + /// Gets or sets the agreement type. + /// + public AgreementType AgreementType { get; set; } + + /// + /// Gets or sets the template identifier for the agreement. + /// + public string TemplateId { get; set; } + + /// + /// Gets or sets the ranking for the version for enforcement. + /// + public int VersionRank { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Analytics/PSCustomerLicensesDeploymentInsights.cs b/src/PowerShell/Models/Analytics/PSCustomerLicensesDeploymentInsights.cs new file mode 100644 index 0000000..2b9d7ed --- /dev/null +++ b/src/PowerShell/Models/Analytics/PSCustomerLicensesDeploymentInsights.cs @@ -0,0 +1,47 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics +{ + using Common; + using PartnerCenter.Models.Analytics; + + /// + /// Holds analytics information about deployment of licenses at the customer level. + /// + public sealed class PSCustomerLicensesDeploymentInsights : PSCustomerLicensesInsightsBase + { + /// + /// Initializes a new instance of the class. + /// + public PSCustomerLicensesDeploymentInsights() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base insights for this instance. + public PSCustomerLicensesDeploymentInsights(CustomerLicensesDeploymentInsights insights) + { + this.CopyFrom(insights); + } + + /// + /// Gets or sets the number of License/seats deployed as of processed date. + /// + public long LicensesDeployed { get; set; } + + /// + /// Gets or sets the number of sold seats/licenses as of processed time stamp. + /// + public long LicensesSold { get; set; } + + /// + /// Gets or sets the deployment percent of the licenses of the customer. + /// + public double DeploymentPercent { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Analytics/PSCustomerLicensesInsightsBase.cs b/src/PowerShell/Models/Analytics/PSCustomerLicensesInsightsBase.cs new file mode 100644 index 0000000..c0b80a0 --- /dev/null +++ b/src/PowerShell/Models/Analytics/PSCustomerLicensesInsightsBase.cs @@ -0,0 +1,40 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics +{ + /// + /// SDK business object model for common properties of customer licenses analytics. + /// + public abstract class PSCustomerLicensesInsightsBase : PSLicensesInsightsBase + { + /// + /// Gets or sets the customer identifier. + /// + public string CustomerId { get; set; } + + /// Gets or sets the customer name. + /// + public string CustomerName { get; set; } + + /// + /// Gets or sets the product/plan name of the given service. + /// + /// + /// (Example: OFFICE 365 BUSINESS ESSENTIALS) + /// + public string ProductName { get; set; } + + /// + /// Gets or sets the Service Code of the License. + /// + /// + /// Example (Office 365 : O365) + /// + public string ServiceCode { get; set; } + } +} diff --git a/src/PowerShell/Models/Analytics/PSLicensesInsightsBase.cs b/src/PowerShell/Models/Analytics/PSLicensesInsightsBase.cs new file mode 100644 index 0000000..9afaae1 --- /dev/null +++ b/src/PowerShell/Models/Analytics/PSLicensesInsightsBase.cs @@ -0,0 +1,48 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics +{ + using System; + using Common; + using PartnerCenter.Models.Analytics; + + /// + /// This resource represents partner's licenses analytics collection. + /// + public class PSLicensesInsightsBase + { + /// + /// Initializes a new instance of the class. + /// + public PSLicensesInsightsBase() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer for this instance. + public PSLicensesInsightsBase(LicensesInsightsBase insight) + { + this.CopyFrom(insight); + } + + /// + /// Gets or sets the Channel name of service (Example: Reseller, Direct). + /// + public string Channel { get; set; } + + /// + /// Gets or sets the Last Processed date for data. + /// + public DateTimeOffset ProcessedDateTime { get; set; } + + /// + /// Gets or sets the Service name (Example : Office, CRM). + /// + public string ServiceName { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Analytics/PSPartnerLicensesDeploymentInsight.cs b/src/PowerShell/Models/Analytics/PSPartnerLicensesDeploymentInsight.cs new file mode 100644 index 0000000..8cbb9ab --- /dev/null +++ b/src/PowerShell/Models/Analytics/PSPartnerLicensesDeploymentInsight.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics +{ + using Common; + using PartnerCenter.Models.Analytics; + + /// + /// Holds the analytics information about the deployment of all customers' licenses of the given partner. + /// + public sealed class PSPartnerLicensesDeploymentInsight : PSLicensesInsightsBase + { + /// + /// Initializes a new instance of the class. + /// + public PSPartnerLicensesDeploymentInsight() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer for this instance. + public PSPartnerLicensesDeploymentInsight(PartnerLicensesDeploymentInsights insight) + { + this.CopyFrom(insight); + } + + /// + /// Gets or sets the number of licenses sold as of processed time stamp. + /// + public long LicensesSold { get; set; } + + /// + /// Gets or sets the percentage of licenses deployed by all the customers of this partner. + /// + public double ProratedDeploymentPercent { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Analytics/PSPartnerLicensesUsageInsight.cs b/src/PowerShell/Models/Analytics/PSPartnerLicensesUsageInsight.cs new file mode 100644 index 0000000..0036cde --- /dev/null +++ b/src/PowerShell/Models/Analytics/PSPartnerLicensesUsageInsight.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Analytics +{ + using Common; + using PartnerCenter.Models.Analytics; + + /// + /// This resource represents partner's licenses analytics collection. + /// + public sealed class PSPartnerLicensesUsageInsight : PSLicensesInsightsBase + { + /// + /// Initializes a new instance of the class. + /// + public PSPartnerLicensesUsageInsight() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base insights for this instance. + public PSPartnerLicensesUsageInsight(PartnerLicensesUsageInsights insight) + { + this.CopyFrom(insight); + } + + /// + /// Gets or sets the usage percentage of the given workload out of qualified licenses of all customers of the partner. + /// + public double ProratedLicensesUsagePercent { get; set; } + + /// + /// Gets or sets the Workload name. For example: Exchange. + /// + public string WorkloadName { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Auditing/PSAuditRecord.cs b/src/PowerShell/Models/Auditing/PSAuditRecord.cs new file mode 100644 index 0000000..38204dd --- /dev/null +++ b/src/PowerShell/Models/Auditing/PSAuditRecord.cs @@ -0,0 +1,104 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Auditing +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Auditing; + + /// + /// Represents a record of operation performed by a partner user or application + /// + public sealed class PSAuditRecord + { + /// + /// Initializes a new instance of the class. + /// + public PSAuditRecord() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base audit record for this instance. + public PSAuditRecord(AuditRecord auditRecord) + { + this.CopyFrom(auditRecord); + } + + /// + /// Gets or sets a unique id for the audit record. + /// + public string AuditRecordId { get; set; } + + /// + /// Gets or sets the identifier of the application invoking the operation. + /// + public string ApplicationId { get; set; } + + /// + /// Gets or sets the identifier of customer in whose context operation was performed. + /// + public string CustomerId { get; set; } + + /// + /// Gets or sets the name of customer in whose context operation was performed. + /// + public string CustomerName { get; set; } + + /// + /// Gets or sets the dictionary which holds additional data that is customized to the operation performed. + /// + public IEnumerable> CustomizedData { get; set; } + + /// + /// Gets or sets the type of the operation being performed. + /// + public OperationType OperationType { get; set; } + + /// + /// Gets or sets the correlation identifier associated with the initial operation that created this audit record. + /// + public string OriginalCorrelationId { get; set; } + + /// + /// Gets or sets the dateTime when the operation was performed. + /// + public DateTime OperationDate { get; set; } + + /// + /// Gets or sets the status of the operation that is audited. + /// + public OperationStatus OperationStatus { get; set; } + + /// + /// Gets or sets the partner identifier. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the new value of the resource. + /// + public string ResourceNewValue { get; set; } + + /// + /// Gets or sets the old value of the resource. + /// + public string ResourceOldValue { get; set; } + + /// + /// Gets or sets the type of the resource acted upon by the operation. + /// + public ResourceType ResourceType { get; set; } + + /// + /// Gets or sets the user principal name of the user that performed the operation. + /// + public string UserPrincipalName { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Carts/PSCart.cs b/src/PowerShell/Models/Carts/PSCart.cs new file mode 100644 index 0000000..ff8e3bd --- /dev/null +++ b/src/PowerShell/Models/Carts/PSCart.cs @@ -0,0 +1,73 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Carts +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Carts; + + /// + /// This class represents a model of a cart object. + /// + public sealed class PSCart + { + /// + /// Initializes a new instance of the class. + /// + public PSCart() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base cart for this instance. + public PSCart(Cart cart) + { + this.CopyFrom(cart, CloneAdditionalOperations); + } + + /// + /// Gets or sets a unique cart identifier. + /// + public string CartId { get; set; } + + /// + /// Gets or sets the creation timestamp. + /// + public DateTime? CreationTimestamp { get; set; } + + /// + /// Gets or sets the expiration timestamp. + /// + public DateTime ExpirationTimestamp { get; set; } + + /// + /// Gets or sets the last modified timestamp. + /// + public DateTime? LastModifiedTimestamp { get; set; } + + /// + /// Gets or sets the last modified user or application. + /// + public string LastModifiedUser { get; set; } + + /// + /// Gets or sets a collection of cart line items. + /// + public IEnumerable LineItems { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The cart being cloned. + private void CloneAdditionalOperations(Cart cart) + { + CartId = cart.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Carts/PSCartCheckoutResult.cs b/src/PowerShell/Models/Carts/PSCartCheckoutResult.cs new file mode 100644 index 0000000..4d97005 --- /dev/null +++ b/src/PowerShell/Models/Carts/PSCartCheckoutResult.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Carts +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Carts; + using PartnerCenter.Models.Orders; + + /// + /// Represents a result of a cart checkout. + /// + public sealed class PSCartCheckoutResult + { + /// + /// Initializes a new instance of the class. + /// + public PSCartCheckoutResult() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of the class that will serve as a base for this instance. + public PSCartCheckoutResult(CartCheckoutResult checkoutResult) + { + this.CopyFrom(checkoutResult); + } + + /// + /// Gets or sets a collection of order failure information. + /// + public IEnumerable OrderErrors { get; set; } + + /// + /// Gets or sets the orders created. + /// + public IEnumerable Orders { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Carts/PSCartLineItem.cs b/src/PowerShell/Models/Carts/PSCartLineItem.cs new file mode 100644 index 0000000..952e527 --- /dev/null +++ b/src/PowerShell/Models/Carts/PSCartLineItem.cs @@ -0,0 +1,105 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Carts +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Carts; + using PartnerCenter.Models.Carts.Enums; + using PartnerCenter.Models.Products; + + /// + /// Represents a line item on a cart. + /// + public sealed class PSCartLineItem + { + /// + /// Initializes a new instance of the class. + /// + public PSCartLineItem() + { + ProvisioningContext = new Dictionary(); + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of the class that will serve as a base for this instance. + public PSCartLineItem(CartLineItem lineItem) + { + ProvisioningContext = new Dictionary(); + this.CopyFrom(lineItem, CloneAdditionalOperations); + } + + /// + /// Gets or sets the type of billing cycle for the selected catalog item. + /// + public BillingCycleType BillingCycle { get; set; } + + /// + /// Gets or sets the catalog item identifier. + /// + public string CatalogItemId { get; set; } + + /// + /// Gets or sets the currency code. + /// + public string CurrencyCode { get; set; } + + /// + /// Gets or sets an error associated to this cart line item. + /// + public CartError Error { get; set; } + + /// + /// Gets or sets the friendly name for the result contract (subscription) + /// + public string FriendlyName { get; set; } + + /// + /// Gets or sets a unique identifier of a cart line item. + /// + public int Id { get; set; } + + /// + /// Gets or sets the order group which indicates which items can be place in a single order. + /// + public string OrderGroup { get; set; } + + /// + /// Gets or sets a collection of participants on this purchase. + /// + public IEnumerable> Participants { get; set; } + + /// + /// Gets or sets a context that will be used for provisioning of the catalog item. + /// + public Dictionary ProvisioningContext { get; } + + /// + /// Gets or sets the product quantity. + /// + public int Quantity { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// An instance of the class that will serve as base for this instance. + private void CloneAdditionalOperations(CartLineItem lineItem) + { + if (lineItem.ProvisioningContext == null) + { + return; + } + + foreach (KeyValuePair item in lineItem.ProvisioningContext) + { + ProvisioningContext.Add(item.Key, item.Value); + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/ConfigurationPolicies/PSConfigurationPolicy.cs b/src/PowerShell/Models/ConfigurationPolicies/PSConfigurationPolicy.cs new file mode 100644 index 0000000..246f926 --- /dev/null +++ b/src/PowerShell/Models/ConfigurationPolicies/PSConfigurationPolicy.cs @@ -0,0 +1,73 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// -------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.DevicesDeployment; + + public sealed class PSConfigurationPolicy + { + /// + /// Initializes a new instance of the class. + /// + public PSConfigurationPolicy() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base configuration policy for this instance. + public PSConfigurationPolicy(ConfigurationPolicy configurationPolicy) + { + this.CopyFrom(configurationPolicy, CloneAdditionalOperations); + } + + // + // Summary: + // Gets or sets the policy unique identifier. + public string PolicyId { get; set; } + // + // Summary: + // Gets or sets the name associated with the policy. + public string Name { get; set; } + // + // Summary: + // Gets or sets the category of the policy. + public PolicyCategory Category { get; set; } + // + // Summary: + // Gets or sets the description for a policy. + public string Description { get; set; } + // + // Summary: + // Gets or sets the number of devices assigned to a policy. + public int DevicesAssignedCount { get; set; } + // + // Summary: + // Gets or sets the settings for a policy. + public IEnumerable PolicySettings { get; set; } + // + // Summary: + // Gets or sets the date the policy was created. + public DateTime CreatedDate { get; set; } + // + // Summary: + // Gets or sets the date the policy was modified. + public DateTime LastModifiedDate { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The customer being cloned. + private void CloneAdditionalOperations(ConfigurationPolicy configurationPolicy) + { + PolicyId = configurationPolicy.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/CountryValidationRules/PSCountryValidationRules.cs b/src/PowerShell/Models/CountryValidationRules/PSCountryValidationRules.cs new file mode 100644 index 0000000..fcda77c --- /dev/null +++ b/src/PowerShell/Models/CountryValidationRules/PSCountryValidationRules.cs @@ -0,0 +1,116 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.CountryValidationRules +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.CountryValidationRules; + + /// Holds validation information for a single country. + public sealed class PSCountryValidationRules + { + /// + /// Initializes a new instance of the class. + /// + public PSCountryValidationRules() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer for this instance. + public PSCountryValidationRules(CountryValidationRules rules) + { + this.CopyFrom(rules); + } + + /// + /// Gets or sets the country calling codes. + /// + public IEnumerable CountryCallingCodesList { get; set; } + + /// + /// Gets or sets the default culture. + /// + public string DefaultCulture { get; set; } + + /// + /// Gets or sets the ISO2 code. + /// + public string Iso2Code { get; set; } + + /// + /// Gets or sets a value indicating whether a city is required or not. + /// + public bool IsCityRequired { get; set; } + + /// + /// Gets or sets a value indicating whether a postal code is required or not. + /// + public bool IsPostalCodeRequired { get; set; } + + /// + /// Gets or sets a value indicating whether the state is required or not. + /// + public bool IsStateRequired { get; set; } + + /// + /// Gets or sets a value indicating whether a tax identifier is optional or not. + /// + public bool IsTaxIdOptional { get; set; } + + /// + /// Gets or sets a value indicating whether a tax identifier is supported or not. + /// + public bool IsTaxIdSupported { get; set; } + + /// + /// Gets or sets a value indicating whether a VAT identifier is required or not. + /// + public bool IsVatIdSupported { get; set; } + + /// + /// Gets or sets the phone number regular expression. + /// + public string PhoneNumberRegex { get; set; } + + /// + /// Gets or sets the postal code regular expression. + /// + public string PostalCodeRegex { get; set; } + + /// + /// Gets or sets a list of supported cultures. + /// + public IEnumerable SupportedCulturesList { get; set; } + + /// + /// Gets or sets a list of supported languages. + /// + public IEnumerable SupportedLanguagesList { get; set; } + + /// + /// Gets or sets a list of states in the country. + /// + public IEnumerable SupportedStatesList { get; set; } + + /// + /// Gets or sets the tax identifier format. + /// + public string TaxIdFormat { get; set; } + + /// + /// Gets or sets the tax identifier sample. + /// + public string TaxIdSample { get; set; } + + /// + /// Gets or sets the tax identifier regular expression. + /// + public string VatIdRegex { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/CustomerRelationshipRequests/PSCustomerRelationshipRequest.cs b/src/PowerShell/Models/CustomerRelationshipRequests/PSCustomerRelationshipRequest.cs new file mode 100644 index 0000000..9d17c9f --- /dev/null +++ b/src/PowerShell/Models/CustomerRelationshipRequests/PSCustomerRelationshipRequest.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerRelationshipRequests +{ + using System; + using Common; + using PartnerCenter.Models.RelationshipRequests; + + /// + /// Represents a customer relationship request with a partner. + /// + public sealed class PSCustomerRelationshipRequest + { + /// + /// Initializes a new instance of the class. + /// + public PSCustomerRelationshipRequest() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer relationship request for this instance. + public PSCustomerRelationshipRequest(CustomerRelationshipRequest relationship) + { + this.CopyFrom(relationship); + } + + /// + /// Gets or sets the URL to be used by the customer to establish a relationship with a partner. + /// + public Uri Url { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/CustomerSubscriptionUpgrades/PsCustomerSubscriptionUpgrades.cs b/src/PowerShell/Models/CustomerSubscriptionUpgrades/PsCustomerSubscriptionUpgrades.cs new file mode 100644 index 0000000..01da94e --- /dev/null +++ b/src/PowerShell/Models/CustomerSubscriptionUpgrades/PsCustomerSubscriptionUpgrades.cs @@ -0,0 +1,55 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerSubscriptionUpgrades +{ + using Common; + using Microsoft.Store.PartnerCenter.Models.Offers; + using Microsoft.Store.PartnerCenter.Models.Subscriptions; + + /// Holds customer trial conversion offers. + public sealed class PSCustomerSubscriptionUpgrades + { + /// + /// Initializes a new instance of the class. + /// + public PSCustomerSubscriptionUpgrades() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base conversion for this instance. + + public PSCustomerSubscriptionUpgrades(Upgrade upgrade) + { + this.CopyFrom(upgrade); + } + + // + // Summary: + // Gets or sets the offer to upgrade to. + public Offer TargetOffer { get; set; } + + // + // Summary: + // Gets or sets the type of upgrade. + public UpgradeType UpgradeType { get; set; } + + // + // Summary: + // Gets or sets a value indicating whether the upgrade can be performed. + public bool IsEligible { get; set; } + + // + // Summary: + // Gets or sets the quantity to be purchased. Defaults to the source subscription + // quantity. + public int Quantity { get; set; } + + } + +} diff --git a/src/PowerShell/Models/CustomerTrialConversion/PSCustomerTrialConversion.cs b/src/PowerShell/Models/CustomerTrialConversion/PSCustomerTrialConversion.cs new file mode 100644 index 0000000..9d79b98 --- /dev/null +++ b/src/PowerShell/Models/CustomerTrialConversion/PSCustomerTrialConversion.cs @@ -0,0 +1,56 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerTrialConversion +{ + using Common; + using PartnerCenter.Models.Offers; + using PartnerCenter.Models.Subscriptions; + + /// Holds customer trial conversion offers. + public sealed class PSCustomerTrialConversion + { + /// + /// Initializes a new instance of the class. + /// + public PSCustomerTrialConversion() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base conversion for this instance. + public PSCustomerTrialConversion(Conversion conversion) + { + this.CopyFrom(conversion); + } + + /// + /// Gets or sets the offer list. + /// + public string OfferId { get; set; } + + /// + /// Gets or sets the target offer. + /// + public string TargetOfferId { get; set; } + + /// + /// Gets or sets the order id. + /// + public string OrderId { get; set; } + + /// + /// Gets or sets the quanity. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets a the billing cycle. + /// + public BillingCycleType BillingCycle { get; set; } + } +} diff --git a/src/PowerShell/Models/CustomerUsers/PSCustomerUser.cs b/src/PowerShell/Models/CustomerUsers/PSCustomerUser.cs new file mode 100644 index 0000000..50ed454 --- /dev/null +++ b/src/PowerShell/Models/CustomerUsers/PSCustomerUser.cs @@ -0,0 +1,85 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.CustomerUsers +{ + using System; + using Common; + using PartnerCenter.Models.Users; + + /// + /// Represents a form of customer users. + /// + public sealed class PSCustomerUser + { + /// + /// Initializes a new instance of the class. + /// + public PSCustomerUser() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer user for this instance. + public PSCustomerUser(CustomerUser customerUser) + { + this.CopyFrom(customerUser, CloneAdditionalOperations); + } + + /// + /// Gets or sets the user object identifier. + /// + public string UserId { get; set; } + + /// + /// Gets or sets the display name. + /// + public string DisplayName { get; set; } + + /// + /// Gets or sets the name of the user principal. + /// + public string UserPrincipalName { get; set; } + + /// + /// Gets or sets the first name. + /// + public string FirstName { get; set; } + + /// + /// Gets or sets the last name. + /// + public string LastName { get; set; } + + /// + /// Gets or sets user domain type. + /// + public UserDomainType UserDomainType { get; set; } + + /// + /// Gets or sets the state of the user, for the deleted user this is "Inactive" and + /// for the normal user it is "Active". + /// + public UserState State { get; set; } + + /// + /// Gets or sets the deleted time for the inactive user. + /// + public DateTime? SoftDeletionTime { get; set; } + + /// + /// Gets or sets the last directory sync time for the user. + /// + public DateTime? LastDirectorySyncTime { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The customer user being cloned. + private void CloneAdditionalOperations(CustomerUser customerUser) => UserId = customerUser.Id; + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Customers/PSCustomer.cs b/src/PowerShell/Models/Customers/PSCustomer.cs new file mode 100644 index 0000000..e5456c3 --- /dev/null +++ b/src/PowerShell/Models/Customers/PSCustomer.cs @@ -0,0 +1,86 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Customers +{ + using Common; + using PartnerCenter.Models.Customers; + + /// + /// Represents a partner's customer. + /// + public sealed class PSCustomer + { + /// + /// Initializes a new instance of the class. + /// + public PSCustomer() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer for this instance. + public PSCustomer(Customer customer) + { + this.CopyFrom(customer, CloneAdditionalOperations); + } + + /// + /// Gets or sets a value that indicates if delegated access is allowed for this customer or not. + /// + public bool? AllowDelegatedAccess { get; set; } + + /// + /// Gets or sets the indirect reseller associated to this customer account. + /// + /// + /// This value can be set only by indirect CSP partners. + /// + public string AssociatedPartnerId { get; set; } + + /// + /// Gets or sets the customer's billing profile. + /// + public CustomerBillingProfile BillingProfile { get; set; } + + /// + /// Gets or sets the commerce identifier. + /// + public string CommerceId { get; set; } + + /// + /// Gets or sets the customer identifier. + /// + public string CustomerId { get; set; } + + /// + /// Gets or sets the Azure AD domain associated with the customer. + /// + public string Domain { get; set; } + + /// + /// Gets or sets the name of the customer. + /// + public string Name { get; set; } + + /// + /// Gets or sets the customer's relationship to partner. + /// + public CustomerPartnerRelationship RelationshipToPartner { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The customer being cloned. + private void CloneAdditionalOperations(Customer customer) + { + CustomerId = customer.Id; + Domain = customer.CompanyProfile.Domain; + Name = customer.CompanyProfile.CompanyName; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/DevicesDeployment/PSDevice.cs b/src/PowerShell/Models/DevicesDeployment/PSDevice.cs new file mode 100644 index 0000000..212dbba --- /dev/null +++ b/src/PowerShell/Models/DevicesDeployment/PSDevice.cs @@ -0,0 +1,87 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.DevicesDeployment; + + /// + /// Represents a customer device. + /// + public sealed class PSDevice + { + /// + /// Initializes a new instance of the class. + /// + public PSDevice() + { + Policies = new List>(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The base PSDevice for this instance. + public PSDevice(Device device) + { + this.CopyFrom(device, CloneAdditionalOperations); + } + + /// + /// Gets or sets the list of HTTP methods allowed on a device as GET, PATCH, DELETE. + /// + public IEnumerable AllowedOperations { get; set; } + + /// + /// Gets or sets the device identifier. + /// + public string DeviceId { get; set; } + + /// + /// Gets or sets the hardware hash associated with a device. + /// + public string HardwareHash { get; set; } + + /// + /// Gets or sets the model name. + /// + public string ModelName { get; set; } + + /// + /// Gets or sets OEM manufacture name. + /// + public string OemManufacturerName { get; set; } + + /// + /// Gets or sets the policies assigned. + /// + public List> Policies { get; } + + /// + /// Gets or sets the product key. + /// + public string ProductKey { get; set; } + + /// + /// Gets or sets the serial number. + /// + public string SerialNumber { get; set; } + + /// + /// Gets or sets the UTC date the Device was uploaded. + /// + public DateTime UploadedDate { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The device being cloned. + private void CloneAdditionalOperations(Device device) => DeviceId = device.Id; + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/DevicesDeployment/PSDeviceBatch.cs b/src/PowerShell/Models/DevicesDeployment/PSDeviceBatch.cs new file mode 100644 index 0000000..d0c4d7f --- /dev/null +++ b/src/PowerShell/Models/DevicesDeployment/PSDeviceBatch.cs @@ -0,0 +1,71 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.DevicesDeployment +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.DevicesDeployment; + + /// + /// Represents a customer device. + /// + public sealed class PSDeviceBatch + { + /// + /// Initializes a new instance of the class. + /// + public PSDeviceBatch() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base device batch for this instance. + public PSDeviceBatch(DeviceBatch deviceBatch) + { + this.CopyFrom(deviceBatch, CloneAdditionalOperations); + } + + /// + /// Gets or sets the list of HTTP methods allowed on a device as GET, PATCH, DELETE. + /// + public IEnumerable AllowedOperations { get; set; } + + /// + /// Gets or sets the devices batch unique identifier. + /// + public string BatchId { get; set; } + + /// + /// Gets or sets the name of the tenant who created the batch. + /// + public string CreatedBy { get; set; } + + /// + /// Gets or sets the date the batch was created. + /// + public DateTime CreationDate { get; set; } + + /// + /// Gets or sets the count of devices in the batch. + /// + public int DevicesCount { get; set; } + + /// + /// Gets or sets the link to the devices under the batch. + /// + public Link DevicesLink { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The device batch being cloned. + private void CloneAdditionalOperations(DeviceBatch deviceBatch) => BatchId = deviceBatch.Id; + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Entitlements/PSEntitlement.cs b/src/PowerShell/Models/Entitlements/PSEntitlement.cs new file mode 100644 index 0000000..c1f0d52 --- /dev/null +++ b/src/PowerShell/Models/Entitlements/PSEntitlement.cs @@ -0,0 +1,73 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Entitlements +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Entitlements; + + /// + /// This resource represents the products to which the customer has right to use because of partner purchase on items from the catalog. + /// + public sealed class PSEntitlement + { + /// + /// Initializes a new instance of the class. + /// + public PSEntitlement() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base customer for this instance. + public PSEntitlement(Entitlement entitlement) + { + this.CopyFrom(entitlement); + } + + /// + /// Gets or sets collection of entitled artifacts. + /// + public IEnumerable EntitledArtifacts { get; set; } + + /// + /// Gets or sets the entitlement type. + /// + public string EntitlementType { get; set; } + + /// + /// Gets or sets included entitlements. + /// + public IEnumerable IncludedEntitlements { get; set; } + + /// + /// Gets or sets identifier of the product. + /// + public string ProductId { get; set; } + + /// + /// Gets or sets quantity. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the quantity details (quantity - state). + /// + public IEnumerable QuantityDetails { get; set; } + + /// + /// Gets or sets reference order related to the entitlement. + /// + public ReferenceOrder ReferenceOrder { get; set; } + + /// + /// Gets or sets identifier of the SKU. + /// + public string SkuId { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSBaseAzureDataMarketLineItem.cs b/src/PowerShell/Models/Invoices/PSBaseAzureDataMarketLineItem.cs new file mode 100644 index 0000000..825a216 --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSBaseAzureDataMarketLineItem.cs @@ -0,0 +1,107 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using System; + using PartnerCenter.Models.Invoices; + + /// + /// Groups the common properties for all types of Azure data market invoice line items. + /// + public abstract class PSBaseAzureDataMarketLineItem : PSInvoiceLineItem + { + /// + /// Gets the billing provider. + /// + public override BillingProvider BillingProvider => BillingProvider.AzureDataMarket; + + /// + /// Gets or sets the date charge ends. + /// + public DateTime ChargeEndDate { get; set; } + + /// + /// Gets or sets the date charge begins. + /// + public DateTime ChargeStartDate { get; set; } + + /// + /// Gets or sets the total units consumed. + /// + public decimal ConsumedQuantity { get; set; } + + /// + /// Gets or sets the customer company name. + /// + public string CustomerCompanyName { get; set; } + + /// + /// Gets or sets the invoice number. + /// + public string InvoiceNumber { get; set; } + + /// + /// Gets or sets the order identifier. + /// + public string OrderId { get; set; } + + /// + /// Gets or sets the partner's azure active directory tenant Id. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the partner identifier. + /// + /// + /// For direct reseller, this is the partner's MPN identifier. + /// For indirect reseller, this is the VAR's MPN identifier. + /// + public int PartnerMpnId { get; set; } + + /// + /// Gets or sets the partner name. + /// + public string PartnerName { get; set; } + + /// + /// Gets or sets the region associated with the resource instance. + /// + public string Region { get; set; } + + /// + /// Gets or sets the resource name. + /// + /// + /// Example: Database (GB/month). + /// + public string ResourceName { get; set; } + + /// + /// Gets or sets the service name. + /// + /// + /// Example: Azure Data Service. + /// + public string ServiceName { get; set; } + + /// + /// Gets or sets the description of the subscription. + /// + public string SubscriptionDescription { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription name. + /// + public string SubscriptionName { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSBaseUsageBasedLineItem.cs b/src/PowerShell/Models/Invoices/PSBaseUsageBasedLineItem.cs new file mode 100644 index 0000000..18cbb7a --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSBaseUsageBasedLineItem.cs @@ -0,0 +1,150 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using System; + using PartnerCenter.Models.Invoices; + + /// + /// Groups common properties for usage based invoice line items. + /// + public abstract class PSBaseUsageBasedLineItem : PSInvoiceLineItem + { + /// + /// Gets or sets the Billing cycle type. + /// + public string BillingCycleType { get; set; } + + /// + /// Gets the billing provider. + /// + public override BillingProvider BillingProvider => BillingProvider.Azure; + + /// + /// Gets or sets the date charge ends. + /// + public DateTime ChargeEndDate { get; set; } + + /// + /// Gets or sets the date charge begins. + /// + public DateTime ChargeStartDate { get; set; } + + /// + /// Gets or sets the total units consumed. + /// + public decimal ConsumedQuantity { get; set; } + + /// + /// Gets or sets the customer company name. + /// + public string CustomerCompanyName { get; set; } + + /// + /// Gets or sets the customer identifier. + /// + public string CustomerId { get; set; } + + /// + /// Gets or sets the domain name. + /// + public string DomainName { get; set; } + + /// + /// Gets or sets the invoice number. + /// + public string InvoiceNumber { get; set; } + + /// + /// Gets or sets the partner's Microsoft Partner Network identifier + /// + /// + /// For direct resellers, this is the MPN Id of the reseller. + /// For indirect resellers, this is the MPN Id of the VAR (Value Added Reseller). + /// + public int MpnId { get; set; } + + /// + /// Gets or sets the order identifier. + /// + public string OrderId { get; set; } + + /// + /// Gets or sets the partner billable account identifier. + /// + public string PartnerBillableAccountId { get; set; } + + /// + /// Gets or sets the partner identifier. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the region associated with the resource instance. + /// + public string Region { get; set; } + + /// + /// Gets or sets the partner name. + /// + public string PartnerName { get; set; } + + /// + /// Gets or sets the resource identifier. + /// + public string ResourceGuid { get; set; } + + /// + /// Gets or sets the resource name. + /// + /// + /// Example: Database (GB/month). + /// + public string ResourceName { get; set; } + + /// + /// Gets or sets the service name. + /// + /// + /// Example: Azure Data Service. + /// + public string ServiceName { get; set; } + + /// + /// Gets or sets the service type. + /// + /// + /// Example: Azure SQL Azure DB. + /// + public string ServiceType { get; set; } + + /// + /// Gets or sets the description of the subscription. + /// + public string SubscriptionDescription { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription name. + /// + public string SubscriptionName { get; set; } + + /// + /// Gets or sets the Tier 2 Partner's Microsoft Partner Network identifier. + /// + public int Tier2MpnId { get; set; } + + /// + /// Gets or sets the unit of measure for Azure usage. + /// + public string Unit { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSInvoice.cs b/src/PowerShell/Models/Invoices/PSInvoice.cs new file mode 100644 index 0000000..a7a0869 --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSInvoice.cs @@ -0,0 +1,114 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Invoices; + + /// + /// Represents a monthly billing statement issued to a partner. + /// + public sealed class PSInvoice + { + /// + /// Initializes a new instance of the class. + /// + public PSInvoice() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base invoice for this instance. + public PSInvoice(Invoice invoice) + { + this.CopyFrom(invoice, CloneAdditionalOperations); + } + + /// + /// Gets or sets the amendments. + /// + public IEnumerable Amendments { get; set; } + + /// + /// Gets or sets The ref number of the document which this doc amends of. + /// + public string AmendsOf { get; set; } + + /// + /// Gets or sets the currency used for all invoice item amounts and totals. + /// + public string CurrencyCode { get; set; } + + /// + /// Gets or sets the currency symbol used for all invoice item amounts and totals. + /// + public string CurrencySymbol { get; set; } + + /// + /// Gets or sets the Document type of the invoice (CreditNote, Invoice). + /// + public DocumentType DocumentType { get; set; } + + /// + /// Gets or sets the date the invoice was generated. + /// + public DateTime InvoiceDate { get; set; } + + /// + /// Gets or sets the invoice details. + /// + public IEnumerable InvoiceDetails { get; set; } + + /// + /// Gets or sets the invoice unique identifier. + /// + public string InvoiceId { get; set; } + + /// + /// Gets or sets invoice type. + /// + /// + /// This will be used to set invoice type to Recurring, OneTime for UI to differentiate the types of invoices. + /// + public string InvoiceType { get; set; } + + /// + /// Gets or sets the amount paid by the partner. + /// + /// + /// Paid amount is negative if a payment is received. + /// + public decimal PaidAmount { get; set; } + + /// + /// Gets or sets the link to download the invoice PDF document. + /// + /// + /// This value is not returned as part of the search results, and will only + /// get populated if invoice is accessed by Id. + /// This link auto expires in 30 minutes. + public Uri PdfDownloadLink { get; set; } + + /// + /// Gets or sets the total charges in this invoice. + /// Total charges includes the transactions charges and any adjustments. + /// + public decimal TotalCharges { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The invoice being cloned. + private void CloneAdditionalOperations(Invoice invoice) + { + InvoiceId = invoice.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSInvoiceLineItem.cs b/src/PowerShell/Models/Invoices/PSInvoiceLineItem.cs new file mode 100644 index 0000000..0afb022 --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSInvoiceLineItem.cs @@ -0,0 +1,26 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using PartnerCenter.Models.Invoices; + + /// + /// Represents a line item on an invoice. + /// + public abstract class PSInvoiceLineItem + { + /// + /// Gets the type of invoice line item. + /// + public abstract InvoiceLineItemType InvoiceLineItemType { get; } + + /// + /// Gets the billing provider. + /// + public abstract BillingProvider BillingProvider { get; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSInvoiceSummary.cs b/src/PowerShell/Models/Invoices/PSInvoiceSummary.cs new file mode 100644 index 0000000..a610e2e --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSInvoiceSummary.cs @@ -0,0 +1,83 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Invoices; + + /// + /// Represents a summary of the partner's monthly bills. + /// + public sealed class PSInvoiceSummary + { + /// + /// Initializes a new instance of the class. + /// + public PSInvoiceSummary() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base invoice summary for this instance. + /// + /// is null. + /// + public PSInvoiceSummary(InvoiceSummary invoiceSummary) + { + invoiceSummary.AssertNotNull(nameof(invoiceSummary)); + + this.CopyFrom(invoiceSummary); + } + + /// + /// Gets or sets the date the balance amount was last updated. + /// + public DateTime AccountingDate { get; set; } + /// + /// Gets or sets the balance amount. This is the total amount of unpaid bills. + /// + public decimal BalanceAmount { get; set; } + + /// + /// Gets or sets the currency code for the balance amount. + /// + public string CurrencyCode { get; set; } + + /// + /// Gets or sets the currency symbol used for all invoice item amounts and totals. + /// + public string CurrencySymbol { get; set; } + + /// + /// Gets or sets the details include invoice summary from recurring, perpetual. + /// + public IEnumerable Details { get; set; } + + /// + /// Gets or sets the date on which the first invoice was created. + /// + public DateTime FirstInvoiceCreationDate { get; set; } + + /// + /// Gets or sets the last payment amount. + /// + public decimal LastPaymentAmount { get; set; } + + /// + /// Gets or sets the last payment date. + /// + public DateTime LastPaymentDate { get; set; } + + /// + /// Gets or sets the date of latest invoice. + /// + public DateTime LatestInvoiceDate { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSLicenseBasedLineItem.cs b/src/PowerShell/Models/Invoices/PSLicenseBasedLineItem.cs new file mode 100644 index 0000000..1725123 --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSLicenseBasedLineItem.cs @@ -0,0 +1,171 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using System; + using PartnerCenter.Models.Invoices; + + /// + /// Represents an invoice billing line item for licensed based subscriptions. + /// + public sealed class PSLicenseBasedLineItem : PSInvoiceLineItem + { + /// + /// Gets or sets the total amount. Total amount = unit price * quantity. + /// + public decimal Amount { get; set; } + + /// + /// Gets or sets the billing cycle type. + /// + public string BillingCycleType { get; set; } + + /// + /// Gets the billing provider. + /// + public override BillingProvider BillingProvider => BillingProvider.Office; + + /// + /// Gets or sets the end date for the charge. + /// + public DateTime ChargeEndDate { get; set; } + + /// + /// Gets or sets the start date for the charge. + /// + public DateTime ChargeStartDate { get; set; } + + /// + /// Gets or sets the type of charge. + /// + public string ChargeType { get; set; } + + /// + /// Gets or sets the currency used for this line item. + /// + public string Currency { get; set; } + + /// + /// Gets or sets the customer identifier.. + /// + public string CustomerId { get; set; } + + /// + /// Gets or sets the customer name. + /// + public string CustomerName { get; set; } + + /// + /// Gets or sets domain name. + /// + public string DomainName { get; set; } + + /// + /// Gets or sets the durable offer unique identifier. + /// + public string DurableOfferId { get; set; } + + /// + /// Gets the type of invoice line item. + /// + public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.BillingLineItems; + + /// + /// Gets or sets the MPN Id associated to this line item. + /// + /// + /// For direct resellers, this is the MPN Id of the reseller. + /// For indirect resellers, this is the MPN Id of the VAR (Value Added Reseller). + /// + public int MpnId { get; set; } + + /// + /// Gets or sets the offer unique identifier. + /// + public string OfferId { get; set; } + + /// + /// Gets or sets the offer name. + /// + public string OfferName { get; set; } + + /// + /// Gets or sets the order unique identifier. + /// + public string OrderId { get; set; } + + /// + /// Gets or sets the partner identifier. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the number of units associated with this line item. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the subscription description. + /// + public string SubscriptionDescription { get; set; } + + /// + /// Gets or sets the date when subscription expires. + /// + public DateTime SubscriptionEndDate { get; set; } + + /// + /// Gets or sets the subscription unique identifier. + /// + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription name. + /// + public string SubscriptionName { get; set; } + + /// + /// Gets or sets the date when subscription starts. + /// + public DateTime SubscriptionStartDate { get; set; } + + /// + /// Gets or sets the amount after discount. + /// + public decimal Subtotal { get; set; } + + /// + /// Gets or sets the syndication partner subscription number. + /// + public string SyndicationPartnerSubscriptionNumber { get; set; } + + /// + /// Gets or sets the taxes charged. + /// + public decimal Tax { get; set; } + + /// + /// Gets or sets the MPN identifier of the indirect reseller associated to this line item. + /// + public int Tier2MpnId { get; set; } + + /// + /// Gets or sets the total amount after discount and tax. + /// + public decimal TotalForCustomer { get; set; } + + /// + /// Gets or sets the discount associated with this purchase. + /// + public decimal TotalOtherDiscount { get; set; } + + /// + /// Gets or sets the unit price. + /// + public decimal UnitPrice { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSOneTimeInvoiceLineItem.cs b/src/PowerShell/Models/Invoices/PSOneTimeInvoiceLineItem.cs new file mode 100644 index 0000000..f3548fb --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSOneTimeInvoiceLineItem.cs @@ -0,0 +1,146 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using System; + using PartnerCenter.Models.Invoices; + + /// + /// Represents an invoice billing line item for OneTime purchases. + /// + public class PSOneTimeInvoiceLineItem : PSInvoiceLineItem + { + /// + /// Gets or sets the availability unique identifier. + /// + public string AvailabilityId { get; set; } + + /// + /// Gets the billing provider. + /// + public override BillingProvider BillingProvider => BillingProvider.OneTime; + + /// + /// Gets or sets the type of charge. + /// Examples: Purchase Fee, Cycle Fee, Prorate Fees when Purchase. + /// + /// + /// Examples: Purchase Fee, Cycle Fee, Prorate Fees when Purchase. + /// + public string ChargeType { get; set; } + + /// + /// Gets or sets the currency used for this line item. + /// + public string Currency { get; set; } + + /// + /// Gets or sets the customer's country. + /// + public string CustomerCountry { get; set; } + + /// + /// Gets or sets the customer domain name. + /// + public string CustomerDomainName { get; set; } + + /// + /// Gets or sets the customer identifier. + /// + public string CustomerId { get; set; } + + /// + /// Gets or sets the customer name. + /// + public string CustomerName { get; set; } + + /// + /// Gets or sets the discount details associated with this purchase. + /// + public string DiscountDetails { get; set; } + + /// + /// Gets the the type of invoice line item. + /// + public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.BillingLineItems; + + /// + /// Gets or sets the invoice number. + /// + public string InvoiceNumber { get; set; } + + /// + /// Gets or sets the MPN identifier associated to this line item. + /// + public string MpnId { get; set; } + + /// + /// Gets or sets the date when order created. + /// + public DateTime OrderDate { get; set; } + + /// + /// Gets or sets the order unique identifier. + /// + public string OrderId { get; set; } + + /// + /// Gets or sets the partner identifier. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the product unique identifier. + /// + public string ProductId { get; set; } + + /// + /// Gets or sets the product name. + /// + public string ProductName { get; set; } + + /// + /// Gets or sets the number of units associated with this line item. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the Reseller MPN identifier of the indirect reseller associated to this line item. + /// + public int ResellerMpnId { get; set; } + + /// + /// Gets or sets the SKU unique identifier. + /// + public string SkuId { get; set; } + + /// + /// Gets or sets the SKU name. + /// + public string SkuName { get; set; } + + /// + /// Gets or sets the amount after discount. + /// + public decimal Subtotal { get; set; } + + /// + /// Gets or sets the taxes charged. + /// + public decimal TaxTotal { get; set; } + + /// + /// Gets or sets the total amount after discount and tax. + /// + public decimal TotalForCustomer { get; set; } + + /// + /// Gets or sets the unit price. + /// + public decimal UnitPrice { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Invoices/PSUsageBasedLineItem.cs b/src/PowerShell/Models/Invoices/PSUsageBasedLineItem.cs new file mode 100644 index 0000000..83301dd --- /dev/null +++ b/src/PowerShell/Models/Invoices/PSUsageBasedLineItem.cs @@ -0,0 +1,96 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Invoices +{ + using PartnerCenter.Models.Invoices; + + /// + /// Billing line items for usage based subscriptions. + /// + public sealed class PSUsageBasedLineItem : PSBaseUsageBasedLineItem + { + /// + /// Gets or sets the charge type. + /// + public string ChargeType { get; set; } + + /// + /// Gets or sets the discount on consumption. + /// + public decimal ConsumptionDiscount { get; set; } + + /// + /// Gets or sets the price of quantity consumed. + /// + public decimal ConsumptionPrice { get; set; } + + /// + /// Gets or sets the currency associated with the prices. + /// + public string Currency { get; set; } + + /// + /// Gets or sets the detail line item identifier. + /// + /// + /// Uniquely identifies the line items for cases where calculation is different for units consumed. + /// Example: Total consumed = 1338, 1024 is charged with one rate, 314 is charge with a different rate. + /// + public int DetailLineItemId { get; set; } + + /// + /// Gets or sets the units included in the order. + /// + public decimal IncludedQuantity { get; set; } + + /// Gets the type of invoice line item. + public override InvoiceLineItemType InvoiceLineItemType => InvoiceLineItemType.BillingLineItems; + + /// + /// Gets or sets the price of each unit. + /// + public decimal ListPrice { get; set; } + + /// + /// Gets or sets the quantity consumed above allowed usage. + /// + public decimal OverageQuantity { get; set; } + + /// + /// Gets or sets the price charged before taxes. + /// + public decimal PretaxCharges { get; set; } + + /// + /// Gets or sets the effective price before taxes. + /// + public decimal PretaxEffectiveRate { get; set; } + + /// + /// Gets or sets the effective price after taxes. + /// + public decimal PostTaxEffectiveRate { get; set; } + + /// + /// Gets or sets the total charges after tax. + /// + /// + /// Pretax Charges + Tax Amount. + /// + public decimal PostTaxTotal { get; set; } + + /// + /// Gets or sets the service SKU. + /// + public string Sku { get; set; } + + /// + /// Gets or sets the amount of tax charged. + /// + public decimal TaxAmount { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Licenses/PSLicense.cs b/src/PowerShell/Models/Licenses/PSLicense.cs new file mode 100644 index 0000000..736df65 --- /dev/null +++ b/src/PowerShell/Models/Licenses/PSLicense.cs @@ -0,0 +1,71 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Licenses; + + /// + /// Represents a subscribed product owned by a tenant. + /// + public sealed class PSLicense + { + /// + /// Initializes a new instance of the class. + /// + public PSLicense() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base license for this instance. + public PSLicense(License license) + { + LicensedProductSku = license.ProductSku.Id; + Name = license.ProductSku.Name; + LicenseGroupId = license.ProductSku.LicenseGroupId.ToString(); + this.CopyFrom(license, CloneAdditionalOperations); + } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The license being cloned. + private void CloneAdditionalOperations(License license) + { } + + /// + /// Gets or sets the service plan collection. Service plans refer to services that + /// user is assigned to use. For example , Delve is a service plan which a user is + /// either assigned to use or can be assigned to use. + /// + public IEnumerable ServicePlans { get; set; } + + /// + /// Gets or sets the product SKU which the license applies to. + /// + public ProductSku ProductSku { get; set; } + + /// + /// Gets or sets the product SKU which the license applies to. + /// + public string LicensedProductSku { get; set; } + + /// + /// Gets or sets the licensed product name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the license group id. + /// + public string LicenseGroupId { get; set; } + } +} + diff --git a/src/PowerShell/Models/Licenses/PSSubscribedSku.cs b/src/PowerShell/Models/Licenses/PSSubscribedSku.cs new file mode 100644 index 0000000..0cf2abb --- /dev/null +++ b/src/PowerShell/Models/Licenses/PSSubscribedSku.cs @@ -0,0 +1,91 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Licenses; + + /// + /// Represents a subscribed product owned by a tenant. + /// + public sealed class PSSubscribedSku + { + /// + /// Initializes a new instance of the class. + /// + public PSSubscribedSku() + { + ServicePlans = new List(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The base sku for this instance. + public PSSubscribedSku(SubscribedSku sku) + { + ServicePlans = new List(); + this.CopyFrom(sku, CloneAdditionalOperations); + } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The sku being cloned. + private void CloneAdditionalOperations(SubscribedSku sku) + { + ServicePlans.AddRange(sku.ServicePlans); + } + + /// + /// Gets or sets the number of units available for assignment. This is calculated as Total units - Consumed units. + /// + public int AvailableUnits { get; set; } + + /// + /// Gets or sets the number of units active for assignment. + /// + public int ActiveUnits { get; set; } + + /// + /// Gets or sets the number of consumed units. + /// + public int ConsumedUnits { get; set; } + + /// + /// Gets or sets the number of suspended units. + /// + public int SuspendedUnits { get; set; } + + /// + /// Gets or sets the total units, which is sum of active and warning units. + /// + public int TotalUnits { get; set; } + + /// + /// Gets or sets the number of warning units. + /// + public int WarningUnits { get; set; } + + /// + /// Gets or sets the products. + /// + public ProductSku ProductSku { get; set; } + + /// + /// Gets or sets the collection of service plans of a product. + /// + public List ServicePlans { get; } + + /// + /// Gets or sets the SKU status of a product. + /// + public string CapabilityStatus { get; set; } + } +} + diff --git a/src/PowerShell/Models/ManagedServices/PSManagedService.cs b/src/PowerShell/Models/ManagedServices/PSManagedService.cs new file mode 100644 index 0000000..85dd98e --- /dev/null +++ b/src/PowerShell/Models/ManagedServices/PSManagedService.cs @@ -0,0 +1,84 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.ManagedServices +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.ManagedServices; + + /// + /// Represents a customer's managed service. + /// + public sealed class PSManagedService + { + /// + /// Initializes a new instance of the class. + /// + public PSManagedService() + { + Links = new Dictionary(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The base managed service for this instance. + public PSManagedService(ManagedService managedService) + { + Links = new Dictionary(); + this.CopyFrom(managedService, CloneAdditionalOperations); + } + + /// + /// Gets or sets the managed service group name. + /// + public string GroupName { get; set; } + + /// + /// Gets or sets the Links + /// + public Dictionary Links { get; } + + /// + /// Gets or sets the managed service identifier. + /// + public string ManagedServiceId { get; set; } + + /// + /// Gets or sets the managed service name. + /// + public string Name { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The managed service being cloned. + private void CloneAdditionalOperations(ManagedService managedService) + { + ManagedServiceId = managedService.Id; + + if (managedService.Links != null) + { + if (managedService.Links.AdminService != null) + { + Links.Add(nameof(managedService.Links.AdminService), managedService.Links.AdminService.Uri); + } + + if (managedService.Links.ServiceHealth != null) + { + Links.Add(nameof(managedService.Links.ServiceHealth), managedService.Links.ServiceHealth.Uri); + } + + if (managedService.Links.ServiceTicket != null) + { + Links.Add(nameof(managedService.Links.ServiceTicket), managedService.Links.ServiceTicket.Uri); + } + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Offers/PSOffer.cs b/src/PowerShell/Models/Offers/PSOffer.cs new file mode 100644 index 0000000..28ee90f --- /dev/null +++ b/src/PowerShell/Models/Offers/PSOffer.cs @@ -0,0 +1,140 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Offers +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Invoices; + using PartnerCenter.Models.Offers; + + /// + /// Represents a form of product availability to customer. + /// + public sealed class PSOffer + { + /// + /// Initializes a new instance of the class. + /// + public PSOffer() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base offer for this instance. + public PSOffer(Offer offer) + { + this.CopyFrom(offer, CloneAdditionalOperations); + } + + /// + /// Gets or sets how billing is handled for the item purchase. + /// + public BillingType Billing { get; set; } + + /// + /// Gets or sets the offer category. + /// + public OfferCategory Category { get; set; } + + /// + /// Gets or sets the country where the offer applies. + /// + public string Country { get; set; } + + /// + /// Gets or sets the description of the offer. + /// + public string Description { get; set; } + + /// + /// Gets or sets a flag indicating whether or not the offer is an add-on. + /// + public bool IsAddOn { get; set; } + + /// + /// Gets or sets a flag indicating whether or not the offer is auto renewable. + /// + public bool IsAutoRenewable { get; set; } + + /// + /// Gets or sets a flag indicating whether or not the offer is available for purchase. + /// + public bool IsAvailableForPurchase { get; set; } + + /// + /// Gets or sets a flag indicating whether or not the offer is a trial. + /// + public bool IsTrial { get; set; } + + /// + /// Gets or sets the locale where the offer applies. + /// + public string Locale { get; set; } + + /// + /// Gets or sets the minimum quantity available. + /// + public int MinimumQuantity { get; set; } + + /// + /// Gets or sets the maximum quantity available. + /// + public int MaximumQuantity { get; set; } + + /// + /// Gets or sets the name of the offer. + /// + public string Name { get; set; } + + /// + /// Gets or sets the idntifier of the offer. + /// + public string OfferId { get; set; } + + /// + /// Gets or sets prerequisites for the offer. + /// + public IEnumerable PrerequisiteOffers { get; set; } + + /// + /// Gets or sets the product. + /// + public Product Product { get; set; } + + /// + /// Gets or sets the category rank in the offer collection. + /// + public int Rank { get; set; } + + /// + /// Gets or sets the identifier for the sales group. + /// + public string SalesGroupId { get; set; } + + /// + /// Gets or sets the supported billing cycles for the offer. + /// + public IEnumerable SupportedBillingCycles { get; set; } + + /// + /// Gets or sets the list of offers that this offer can be upgraded to. + /// + public IEnumerable UpgradeTargetOffers { get; set; } + + /// + /// Gets or sets the unit type. + /// + public string UnitType { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The invoice being cloned. + private void CloneAdditionalOperations(Offer offer) => OfferId = offer.Id; + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Orders/PSOrder.cs b/src/PowerShell/Models/Orders/PSOrder.cs new file mode 100644 index 0000000..c8b4be7 --- /dev/null +++ b/src/PowerShell/Models/Orders/PSOrder.cs @@ -0,0 +1,83 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Orders +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Common; + using PartnerCenter.Models.Offers; + using PartnerCenter.Models.Orders; + + /// + /// An order is the mean of purchasing offers. Offers are represented by line items within the order. + /// + public sealed class PSOrder + { + /// + /// Initializes a new instance of the class. + /// + public PSOrder() + { + LineItems = new List(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The base order for this instance. + public PSOrder(Order order) + { + this.CopyFrom(order, CloneAdditionalOperations); + } + + /// + /// Gets or sets the type of billing cycle for the selected offers. + /// + public BillingCycleType BillingCycle { get; set; } + + /// + /// Gets or sets the creation date of the order. + /// + public DateTime? CreationDate { get; set; } + + /// + /// Gets or sets the currency code. + /// + public string CurrencyCode { get; set; } + + /// + /// Gets or sets the Order line items. Each order line item refers to one offer's purchase data. + /// + public List LineItems { get; } + + /// + /// Gets or sets the order identifier. + /// + public string OrderId { get; set; } + + /// + /// Gets or sets the reference customer identifier. + /// + public string ReferenceCustomerId { get; set; } + + /// + /// Gets or sets the order status. + /// + public string Status { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The order being cloned. + private void CloneAdditionalOperations(Order order) + { + LineItems.AddRange(order.LineItems.Select(o => new PSOrderLineItem(o))); + OrderId = order.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Orders/PSOrderLineItem.cs b/src/PowerShell/Models/Orders/PSOrderLineItem.cs new file mode 100644 index 0000000..80655ee --- /dev/null +++ b/src/PowerShell/Models/Orders/PSOrderLineItem.cs @@ -0,0 +1,78 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Orders +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Orders; + + /// + /// An order line item associates order information to a specific offer of a product. + /// + public sealed class PSOrderLineItem + { + /// + /// Initializes a new instance of the class. + /// + public PSOrderLineItem() + { + ProvisioningContext = new Dictionary(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The base order line item for this instance. + public PSOrderLineItem(OrderLineItem orderLineItem) + { + this.CopyFrom(orderLineItem); + } + + /// + /// Gets or sets the friendly name for the result contract (subscription). + /// + public string FriendlyName { get; set; } + + /// + /// Gets or sets the line item number. + /// + public int LineItemNumber { get; set; } + + /// + /// Gets or sets the offer identifier. + /// + public string OfferId { get; set; } + + /// + /// Gets or sets the partner identifier on record. + /// + public string PartnerIdOnRecord { get; set; } + + /// + /// Gets or sets the parent subscription identifier. + /// + /// + /// This parameter should only be set for add-on offer purchase. This applies to Order updates only. + /// + public string ParentSubscriptionId { get; set; } + + /// + /// Gets the provisioning context for the offer. + /// + public Dictionary ProvisioningContext { get; } + + /// + /// Gets or sets the product quantity. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the resulting subscription identifier. + /// + public string SubscriptionId { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Partners/PSBillingProfile.cs b/src/PowerShell/Models/Partners/PSBillingProfile.cs new file mode 100644 index 0000000..aa0f6f8 --- /dev/null +++ b/src/PowerShell/Models/Partners/PSBillingProfile.cs @@ -0,0 +1,68 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Partners +{ + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.Partners; + + /// + /// Represents a partner's billing profile. + /// + public sealed class PSBillingProfile + { + /// + /// Initializes a new instance of the class. + /// + public PSBillingProfile() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base billing profile for this instance. + public PSBillingProfile(BillingProfile profile) + { + this.CopyFrom(profile); + } + + /// + /// Gets or sets the billing address. + /// + public Address Address { get; set; } + + /// + /// Gets or sets the billing currency. + /// + public string BillingCurrency { get; set; } + + /// + /// Gets or sets the billing day. + /// + public int? BillingDay { get; set; } + + /// + /// Gets or sets the billing company name. + /// + public string CompanyName { get; set; } + + /// + /// Gets or sets the billing primary contact. + /// + public Contact PrimaryContact { get; set; } + + /// + /// Gets or sets the purchase order number. + /// + public string PurchaseOrderNumber { get; set; } + + /// + /// Gets or sets the tax identifier. + /// + public string TaxId { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Partners/PSLegalBusinessProfile.cs b/src/PowerShell/Models/Partners/PSLegalBusinessProfile.cs new file mode 100644 index 0000000..7259569 --- /dev/null +++ b/src/PowerShell/Models/Partners/PSLegalBusinessProfile.cs @@ -0,0 +1,68 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Partners +{ + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.Partners; + + /// + /// Represents a partner's legal business profile. + /// + public sealed class PSLegalBusinessProfile + { + /// + /// Initializes a new instance of the class. + /// + public PSLegalBusinessProfile() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base legal business profile for this instance. + public PSLegalBusinessProfile(LegalBusinessProfile profile) + { + this.CopyFrom(profile); + } + + /// + /// Gets or sets the legal business organization name. + /// + public string CompanyName { get; set; } + + /// + /// Gets or sets the legal business address. + /// + public Address Address { get; set; } + + /// + /// Gets or sets the primary contact. + /// + public Contact PrimaryContact { get; set; } + + /// + /// Gets or sets the address of the company approver. + /// + public Address CompanyApproverAddress { get; set; } + + /// + /// Gets or sets the email of the company approver. + /// + public string CompanyApproverEmail { get; set; } + + /// + /// Gets or sets the verification status. + /// + public VettingStatus VettingStatus { get; set; } + + /// + /// Gets or sets the verification sub-status. + /// + public VettingSubStatus VettingSubStatus { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Partners/PSOrganizationProfile.cs b/src/PowerShell/Models/Partners/PSOrganizationProfile.cs new file mode 100644 index 0000000..afb74b3 --- /dev/null +++ b/src/PowerShell/Models/Partners/PSOrganizationProfile.cs @@ -0,0 +1,74 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Partners +{ + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.Partners; + + /// + /// Represents a partner's organization profile. + /// + public sealed class PSOrganizationProfile + { + /// + /// Initializes a new instance of the class. + /// + public PSOrganizationProfile() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The base organization profile for this instance. + public PSOrganizationProfile(OrganizationProfile profile) + { + this.CopyFrom(profile); + } + + /// + /// Gets or sets the company identifier. + /// + public string Id { get; set; } + + /// + /// Gets or sets the organization name. + /// + public string CompanyName { get; set; } + + /// + /// Gets or sets the organization address. + /// + public Address DefaultAddress { get; set; } + + /// + /// Gets or sets the tenant id. + /// + public string TenantId { get; set; } + + /// + /// Gets or sets the company default domain. + /// + public string Domain { get; set; } + + /// + /// Gets or sets the company primary contact email. + /// + public string Email { get; set; } + + /// + /// Gets or sets the company preferred language. + /// + public string Language { get; set; } + + /// + /// Gets or sets the company preferred culture. + /// + public string Culture { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Partners/PSSupportProfile.cs b/src/PowerShell/Models/Partners/PSSupportProfile.cs new file mode 100644 index 0000000..2b491e5 --- /dev/null +++ b/src/PowerShell/Models/Partners/PSSupportProfile.cs @@ -0,0 +1,47 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Partners +{ + using Common; + using PartnerCenter.Models.Partners; + + /// + /// Represents a partner's support profile. + /// + public sealed class PSSupportProfile + { + /// + /// Initializes a new instance of the class. + /// + public PSSupportProfile() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base support profile for this instance. + public PSSupportProfile(SupportProfile profile) + { + this.CopyFrom(profile); + } + + /// + /// Gets or sets the email. + /// + public string Email { get; set; } + + /// + /// Gets or sets the telephone. + /// + public string Telephone { get; set; } + + /// + /// Gets or sets the website. + /// + public string Website { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Products/PSInventoryItem.cs b/src/PowerShell/Models/Products/PSInventoryItem.cs new file mode 100644 index 0000000..4792b33 --- /dev/null +++ b/src/PowerShell/Models/Products/PSInventoryItem.cs @@ -0,0 +1,53 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Products +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Products; + + /// + /// Represents the inventory of a particular product. + /// + public sealed class PSInventoryItem + { + /// + /// Initializes a new instance of the class. + /// + public PSInventoryItem() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base offer for this instance. + public PSInventoryItem(InventoryItem item) + { + this.CopyFrom(item); + } + + /// + /// Gets or sets the id. + /// + public string ProductId { get; set; } + + /// + /// Gets or sets the item sku id. + /// + public string SkuId { get; set; } + + /// + /// Gets or sets a value indicating whether this item currently has any inventory restrictions. + /// + public bool IsRestricted { get; set; } + + /// + /// Gets or sets the restrictions for this item if any. + /// + public IEnumerable Restrictions { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Products/PSProduct.cs b/src/PowerShell/Models/Products/PSProduct.cs new file mode 100644 index 0000000..d482404 --- /dev/null +++ b/src/PowerShell/Models/Products/PSProduct.cs @@ -0,0 +1,66 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Products +{ + using Common; + using PartnerCenter.Models.Products; + + /// + /// Represents a form of product availability to customer. + /// + public sealed class PSProduct + { + /// + /// Initializes a new instance of the class. + /// + public PSProduct() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base offer for this instance. + public PSProduct(Product product) + { + this.CopyFrom(product, CloneAdditionalOperations); + } + + /// + /// Gets or sets the description. + /// + public string Description { get; set; } + + /// + /// Gets or sets the id. + /// + public string ProductId { get; set; } + // + // Summary: + // Gets or sets the product type. + public ItemType ProductType { get; set; } + + /// + /// Gets or sets the product type name. + /// + public string Type { get; set; } + + /// + /// Gets or sets the title. + /// + public string Title { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The product being cloned. + private void CloneAdditionalOperations(Product product) + { + ProductId = product.Id; + Type = product.ProductType.DisplayName; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Products/PSProductAvailability.cs b/src/PowerShell/Models/Products/PSProductAvailability.cs new file mode 100644 index 0000000..446e32e --- /dev/null +++ b/src/PowerShell/Models/Products/PSProductAvailability.cs @@ -0,0 +1,88 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Products +{ + using Common; + using PartnerCenter.Models.Products; + + /// + /// Represents a form of product availability to customer. + /// + public sealed class PSProductAvailability + { + /// + /// Initializes a new instance of the class. + /// + public PSProductAvailability() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base product availablity for this instance. + public PSProductAvailability(Availability productAvailability) + { + this.CopyFrom(productAvailability, CloneAdditionalOperations); + } + + /// + /// Gets or sets the unique availability identifier. + /// + public string AvailabilityId { get; set; } + + /// + /// Gets or sets the id that uniquely identifies this item in the catalog. + /// + public string CatalogItemId { get; set; } + + /// + /// Gets or sets the country. + /// + public string Country { get; set; } + + /// + /// Gets or sets the default currency. + /// + public CurrencyInfo DefaultCurrency { get; set; } + + /// + /// Gets or sets the default currency code. + /// + public string DefaultCurrencyCode { get; set; } + + /// + /// Gets or sets the default currency code. + /// + public string DefaultCurrencySymbol { get; set; } + + /// + /// Gets or sets the product identifier. + /// + public string ProductId { get; set; } + + /// + /// Gets or sets the segment. + /// + public string Segment { get; set; } + + /// + /// Gets or sets the SKU identifier. + /// + public string SkuId { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The product availablity being cloned. + private void CloneAdditionalOperations(Availability productAvailability) + { + AvailabilityId = productAvailability.Id; + DefaultCurrencyCode = productAvailability.DefaultCurrency.Code; + DefaultCurrencySymbol = productAvailability.DefaultCurrency.Symbol; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Products/PSSku.cs b/src/PowerShell/Models/Products/PSSku.cs new file mode 100644 index 0000000..5ff2050 --- /dev/null +++ b/src/PowerShell/Models/Products/PSSku.cs @@ -0,0 +1,113 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Products +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Products; + + /// + /// Represents a form of product availability to customer. + /// + public sealed class PSSku + { + /// + /// Initializes a new instance of the class. + /// + public PSSku() + { + DynamicAttributes = new Dictionary(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The base offer for this instance. + public PSSku(Sku sku) + { + DynamicAttributes = new Dictionary(); + this.CopyFrom(sku, CloneAdditionalOperations); + } + + /// + /// Gets or sets the description. + /// + public string Description { get; set; } + + /// + /// Gets or sets the dynamic attributes. + /// + public Dictionary DynamicAttributes { get; } + + /// + /// Gets or sets the variables needed for inventory check. + /// + public IEnumerable InventoryVariables { get; set; } + + /// + /// Gets or sets a value indicating whether this is a trial sku or not. + /// + public bool IsTrial { get; set; } + + /// + /// Gets or sets the maximum order quantity. + /// + public int MaximumQuantity { get; set; } + + /// + /// Gets or sets the minimum order quantity. + /// + public int MinimumQuantity { get; set; } + + /// + /// Gets or sets the product identifier. + /// + public string ProductId { get; set; } + + /// + /// Gets or sets the provisioning variables. + /// + public IEnumerable ProvisioningVariables { get; set; } + + /// + /// Gets or sets the purchase prerequisites. + /// + public IEnumerable PurchasePrerequisites { get; set; } + + /// + /// Gets or sets the SKU identifier. + /// + public string SkuId { get; set; } + + /// + /// Gets or sets the billing cycles supported for the offer. + /// + public IEnumerable SupportedBillingCycles { get; set; } + + /// + /// Gets or sets the title. + /// + public string Title { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The SKU being cloned. + private void CloneAdditionalOperations(Sku sku) + { + if (sku.DynamicAttributes != null) + { + foreach (KeyValuePair item in sku.DynamicAttributes) + { + DynamicAttributes.Add(item.Key, item.Value); + } + } + + SkuId = sku.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/RateCards/PSAzureRateCard.cs b/src/PowerShell/Models/RateCards/PSAzureRateCard.cs new file mode 100644 index 0000000..8dfb042 --- /dev/null +++ b/src/PowerShell/Models/RateCards/PSAzureRateCard.cs @@ -0,0 +1,58 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.RateCards +{ + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.RateCards; + + /// + /// Provides real-time prices for Azure offers. + /// + public sealed class PSAzureRateCard + { + /// + /// Initializes a new instance of the class. + /// + public PSAzureRateCard() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base rate card for this instance. + public PSAzureRateCard(AzureRateCard rateCard) + { + this.CopyFrom(rateCard); + } + + /// + /// Gets or sets the currency for the the meter rates. + /// + public string Currency { get; set; } + + /// + /// Gets or sets a value indicating whether the tax is included or not. + /// + public bool IsTaxIncluded { get; set; } + + /// + /// Gets or sets the locale for the localizable properties in the rate card meters. + /// + public string Locale { get; set; } + + /// + /// Gets or sets a collection of meters. + /// + public IEnumerable Meters { get; set; } + + /// + /// Gets or sets a collection of offer terms. + /// + public IEnumerable OfferTerms { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Relationships/PSPartnerRelationship.cs b/src/PowerShell/Models/Relationships/PSPartnerRelationship.cs new file mode 100644 index 0000000..d331684 --- /dev/null +++ b/src/PowerShell/Models/Relationships/PSPartnerRelationship.cs @@ -0,0 +1,75 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Relationships +{ + using Common; + using PartnerCenter.Models.Relationships; + + /// + /// This represents a relationship between two partners. + /// + public sealed class PSPartnerRelationship + { + /// + /// Initializes a new instance of the class. + /// + public PSPartnerRelationship() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base relationship for this instance. + public PSPartnerRelationship(PartnerRelationship relationship) + { + this.CopyFrom(relationship, CloneAdditionalOperations); + } + + /// + /// Gets or sets the location of the partner. + /// + public string Location { get; set; } + + /// + /// Gets or set the MPN identifier + /// + public string MpnId { get; set; } + + /// + /// Gets or sets the name of the partner who is in the recipient (from) side of the relationship. + /// + public string Name { get; set; } + + /// + /// Gets or sets the partner identifier. + /// + /// + /// The partner identifier specifies tenant identifier of the + /// partner who is in the recipient (from) side of relationship. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the type of the relationship. + /// + public PartnerRelationshipType RelationshipType { get; set; } + + /// + /// Gets or sets the state of the relationship. + /// + public string State { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The relationship being cloned. + private void CloneAdditionalOperations(PartnerRelationship relationship) + { + PartnerId = relationship.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Roles/PSDirectoryRole.cs b/src/PowerShell/Models/Roles/PSDirectoryRole.cs new file mode 100644 index 0000000..7934031 --- /dev/null +++ b/src/PowerShell/Models/Roles/PSDirectoryRole.cs @@ -0,0 +1,70 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.DirectoryRoles +{ + using Common; + using PartnerCenter.Models.Roles; + + /// + /// This resource represents the directory roles for a customer. + /// + public sealed class PSDirectoryRole + { + /// + /// Initializes a new instance of the class. + /// + public PSDirectoryRole() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base role for this instance. + public PSDirectoryRole(DirectoryRole role) + { + this.CopyFrom(role); + } + + /// + /// Converts an instance of to an instance of . + /// + /// An instance of that will serve as the base for the new instnace of . + public static implicit operator PSDirectoryRole(DirectoryRole role) + { + if (role == null) + { + return null; + } + + return new PSDirectoryRole(role); + } + + /// + /// Gets or sets the role name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the role id. + /// + public string Id { get; set; } + + /// + /// Converts an instance of to an instance of . + /// + /// An instance of that will serve as the base for the new instance of . + public static PSDirectoryRole ToPSDirectoryRole(DirectoryRole role) + { + if (role == null) + { + return null; + } + + return new PSDirectoryRole(role); + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/ServiceRequests/PSServiceRequest.cs b/src/PowerShell/Models/ServiceRequests/PSServiceRequest.cs new file mode 100644 index 0000000..1f1ca98 --- /dev/null +++ b/src/PowerShell/Models/ServiceRequests/PSServiceRequest.cs @@ -0,0 +1,133 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.ServiceRequests +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.ServiceRequests; + + /// + /// Represents a service request. + /// + public sealed class PSServiceRequest + { + /// + /// Initializes a new instance of the class. + /// + public PSServiceRequest() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base offer for this instance. + public PSServiceRequest(ServiceRequest request) + { + this.CopyFrom(request, CloneAdditionalOperations); + } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The product being cloned. + private void CloneAdditionalOperations(ServiceRequest request) + { + ServiceRequestId = request.Id; + } + + /// + /// Gets or sets the service request Id. + /// + public string ServiceRequestId { get; set; } + + /// + /// Gets or sets a new note that can be added to an existing service request. + /// + public ServiceRequestNote NewNote { get; set; } + + /// + /// Gets or sets the ticket last closed date. + /// + public DateTime LastClosedDate { get; set; } + + /// + /// Gets or sets the ticket last modified date. + /// + public DateTime LastModifiedDate { get; set; } + + /// + /// Gets or sets the time the service request was created. + /// + public DateTime CreatedDate { get; set; } + + /// + /// Gets or sets the affected product id. + /// + public string ProductId { get; set; } + + /// + /// Gets or sets the affected product name. + /// + public string ProductName { get; set; } + + /// + /// Gets or sets the last updated by contact for changes to the service request. + /// + public ServiceRequestContact LastUpdatedBy { get; set; } + + /// + /// Gets or sets a collection of notes associated with the service request. + /// + public IEnumerable Notes { get; set; } + + /// + /// Gets or sets the primary contact on the service request. + /// + public ServiceRequestContact PrimaryContact { get; set; } + + /// + /// Gets or sets the service request status. + /// + public ServiceRequestStatus Status { get; set; } + + /// + /// Gets or sets the name of the support topic related to the service request. + /// + public string SupportTopicName { get; set; } + + /// + /// Gets or sets the ID of the support topic for the service request. + /// + public string SupportTopicId { get; set; } + + /// + /// Gets or sets the severity. + /// + public ServiceRequestSeverity Severity { get; set; } + + /// + /// Gets or sets the service request description. + /// + public string Description { get; set; } + + /// + /// Gets or sets the service request title. + /// + public string Title { get; set; } + + /// + /// Gets or sets the organization for whom the service request is being created. + /// + public ServiceRequestOrganization Organization { get; set; } + + /// + /// Gets or sets the country code in ISO 2 alpha format. + /// + public string CountryCode { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/ServiceRequests/PSSupportTopic.cs b/src/PowerShell/Models/ServiceRequests/PSSupportTopic.cs new file mode 100644 index 0000000..f9bdb39 --- /dev/null +++ b/src/PowerShell/Models/ServiceRequests/PSSupportTopic.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.ServiceRequests +{ + using System.Globalization; + using Common; + using PartnerCenter.Models.ServiceRequests; + + /// + /// Represents a service request. + /// + public sealed class PSSupportTopic + { + /// + /// Initializes a new instance of the class. + /// + public PSSupportTopic() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base offer for this instance. + public PSSupportTopic(SupportTopic topic) + { + this.CopyFrom(topic, CloneAdditionalOperations); + } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The product being cloned. + private void CloneAdditionalOperations(SupportTopic topic) + { + SupportTopicId = topic.Id.ToString(CultureInfo.CurrentCulture); + } + + /// + /// Gets or sets the support topic Id. + /// + public string SupportTopicId { get; set; } + + /// + /// Gets or sets the name of the support topic. + /// + public string Name { get; set; } + + /// + /// Gets or sets the description of the support topic. + /// + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Subscriptions/PSSubscription.cs b/src/PowerShell/Models/Subscriptions/PSSubscription.cs new file mode 100644 index 0000000..4320622 --- /dev/null +++ b/src/PowerShell/Models/Subscriptions/PSSubscription.cs @@ -0,0 +1,141 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models; + using PartnerCenter.Models.Invoices; + using PartnerCenter.Models.Offers; + using PartnerCenter.Models.Subscriptions; + + /// + /// The subscription resource represents the life cycle of a subscription and includes + /// properties that define the states throughout the subscription life cycle. + /// + public sealed class PSSubscription : Contract + { + /// + /// Initializes a new instance of the class. + /// + public PSSubscription() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base subscription for this instance. + public PSSubscription(Subscription subscription) + { + this.CopyFrom(subscription, CloneAdditionalOperations); + } + + /// + /// Gets or sets a value indicating whether automatic renew is enabled or not. + /// + public bool AutoRenewEnabled { get; set; } + + /// + /// Gets or sets the billing cycle. + /// + /// + /// Defines how often the partner is billed for this subscription. + /// + public BillingCycleType BillingCycle { get; set; } + + /// + /// Gets or sets the billing type. + /// + public BillingType BillingType { get; set; } + + /// + /// Gets or sets the commitment end date for this subscription. For subscriptions which are not auto renewable, this represents a date far away in the future. + /// + public DateTime CommitmentEndDate { get; set; } + + /// + /// Gets the type of contract. + /// + public override ContractType ContractType => ContractType.Subscription; + + /// + /// Gets or sets the creation date. + /// + public DateTime CreationDate { get; set; } + + /// + /// Gets or sets the effective start date for this subscription. It is used to back date a migrated subscription or to align it with another. + /// + public DateTime EffectiveStartDate { get; set; } + + /// + /// Gets or sets the entitlement identifier. + /// + public string EntitlementId { get; set; } + + /// + /// Gets or sets the friendly name for the subscription. + /// + public string FriendlyName { get; set; } + + /// + /// Gets or sets the offer identifier. + /// + public string OfferId { get; set; } + + /// + /// Gets or sets the offer name. + /// + public string OfferName { get; set; } + + /// + /// Gets or sets the MPN identifier. This only applies to indirect partner scenarios. + /// + public string PartnerId { get; set; } + + /// + /// Gets or sets the parent subscription identifier. + /// + public string ParentSubscriptionId { get; set; } + + /// + /// Gets or sets the quantity. + /// For example, in case of seat based billing, this property is set to seat count. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription status. + /// + public SubscriptionStatus Status { get; set; } + + /// + /// Gets or sets the suspension reason. + /// + public IEnumerable SuspensionReasons { get; set; } + + /// + /// Gets or sets the units defining Quantity for the subscription. + /// + public string UnitType { get; set; } + + /// + /// Addtional operations to be performed when cloning an instance of to an instance of . + /// + /// The subscription being cloned. + private void CloneAdditionalOperations(Subscription subscription) + { + SubscriptionId = subscription.Id; + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Subscriptions/PSSubscriptionProvisioningStatus.cs b/src/PowerShell/Models/Subscriptions/PSSubscriptionProvisioningStatus.cs new file mode 100644 index 0000000..1b86ea8 --- /dev/null +++ b/src/PowerShell/Models/Subscriptions/PSSubscriptionProvisioningStatus.cs @@ -0,0 +1,59 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions +{ + using System; + using Common; + using PartnerCenter.Models.Subscriptions; + + /// + /// The subscription provisioning status details. + /// + public sealed class PSSubscriptionProvisioningStatus + { + /// + /// Initializes a new instance of the class. + /// + public PSSubscriptionProvisioningStatus() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base subscription provisioning status for this instance. + public PSSubscriptionProvisioningStatus(SubscriptionProvisioningStatus status) + { + this.CopyFrom(status); + } + + /// + /// Gets or sets the end date. + /// + /// + /// Renewal or end date after provisioning. + /// + public DateTime EndDate { get; set; } + + /// + /// Gets or sets the quantity + /// + /// + /// Latest seat number or subscription quantity after provisioning. + /// + public int Quantity { get; set; } + + /// + /// Gets or sets the subscription SKU identifier. + /// + public Guid SkuId { get; set; } + + /// + /// Gets or sets the subscription provisioning status. + /// + public ProvisioningStatus Status { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Subscriptions/PSSubscriptionRegistrationStatus.cs b/src/PowerShell/Models/Subscriptions/PSSubscriptionRegistrationStatus.cs new file mode 100644 index 0000000..6d06d7f --- /dev/null +++ b/src/PowerShell/Models/Subscriptions/PSSubscriptionRegistrationStatus.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Subscriptions +{ + using Common; + using PartnerCenter.Models.Subscriptions; + + /// + /// Provides information about the registration status of a subscription. + /// + public sealed class PSSubscriptionRegistrationStatus + { + /// + /// Initializes a new instance of the class. + /// + public PSSubscriptionRegistrationStatus() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The base subscription provisioning status for this instance. + public PSSubscriptionRegistrationStatus(SubscriptionRegistrationStatus status) + { + this.CopyFrom(status); + } + + /// + /// Gets or sets a GUID formatted string that identifies the subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// Gets or sets a value indicating whether this subscription is registered. + /// + public string Status { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/Models/Utilizations/PSAzureUtilizationRecord.cs b/src/PowerShell/Models/Utilizations/PSAzureUtilizationRecord.cs new file mode 100644 index 0000000..70e00aa --- /dev/null +++ b/src/PowerShell/Models/Utilizations/PSAzureUtilizationRecord.cs @@ -0,0 +1,122 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Models.Utilizations +{ + using System; + using System.Collections.Generic; + using Common; + using PartnerCenter.Models.Utilizations; + + /// + /// A utilization record for an Azure subscription resource. + /// + public sealed class PSAzureUtilizationRecord + { + /// + /// Initializes a new instance of the class. + /// + public PSAzureUtilizationRecord() + { } + + /// + /// Initializes a new instance of the class. + /// + /// A utilization record for an Azure subscription resource. + public PSAzureUtilizationRecord(AzureUtilizationRecord azureUtilizationRecord) + { + azureUtilizationRecord.AssertNotNull(nameof(azureUtilizationRecord)); + + this.CopyFrom(azureUtilizationRecord); + } + + /// + /// Gets or sets the the additional info fields. + /// + public IDictionary AdditionalInfo { get; set; } + + /// + /// Gets or sets the category of the consumed Azure resource. + /// + public string Category { get; set; } + + /// + /// Gets or sets the unique identifier of the Azure resource that was consumed. Also known as resourceID or resourceGUID. + /// + public string Id { get; set; } + + /// + /// Gets or sets the key-value pairs of instance-level details. + /// + public IDictionary InfoFields { get; set; } + + /// + /// Gets or sets the region in which the this service was run. + /// + public string Location { get; set; } + + /// + /// Gets or sets the friendly name of the Azure resource being consumed. + /// + public string Name { get; set; } + + /// + /// Gets or sets the unique namespace used to identify the 3rd party order for Azure Marketplace. + /// + public string OrderNumber { get; set; } + + /// + /// Gets or sets the unique namespace used to identify the resource for Azure Marketplace 3rd party usage. + /// + public string PartNumber { get; set; } + + /// + /// Gets or sets the quantity consumed of the Azure resource. + /// + public decimal Quantity { get; set; } + + /// + /// Gets or sets the region of the consumed Azure resource. + /// + public string Region { get; set; } + + /// + /// Gets or sets the fully qualified Azure resource ID, which includes the resource groups and the instance name. + /// + public Uri ResourceUri { get; set; } + + /// + /// Gets or sets the sub-category of the consumed Azure resource. + /// + public string Subcategory { get; set; } + + /// + /// Gets or sets the the resource tags specified by the user. + /// + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the type of quantity (hours, bytes, etc...). + /// + public string Unit { get; set; } + + /// + /// Gets or sets the end of the usage aggregation time range. + /// + /// + /// The response is grouped by the time of consumption (when the resource was actually used VS. when was it reported to the billing system). + /// + public DateTimeOffset UsageEndTime { get; set; } + + /// + /// Gets or sets the start of the usage aggregation time range. + /// + /// + /// The response is grouped by the time of consumption (when the resource was actually used VS. when was it reported to the billing system). + /// + public DateTimeOffset UsageStartTime { get; set; } + } +} \ No newline at end of file diff --git a/src/PowerShell/PartnerCenter.psd1 b/src/PowerShell/PartnerCenter.psd1 new file mode 100644 index 0000000..f9a8e5d --- /dev/null +++ b/src/PowerShell/PartnerCenter.psd1 @@ -0,0 +1,132 @@ +# +# Module manifest for module 'Partner Center' +# +# Generated by: Microsoft Corporation +# +# Generated on: 7/19/2018 +# + +@{ + # Script module or binary module file associated with this manifest. + # RootModule = '' + + # Version number of this module. + ModuleVersion = '0.0.1' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = '70cb9a9e-1491-403a-8a2f-63e1afe7dfee' + + # Author of this module + Author = 'Microsoft Corporation' + + # Company or vendor of this module + CompanyName = 'Microsoft Corporation' + + # Copyright statement for this module + Copyright = 'Microsoft Corporation. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Microsoft Partner Center - cmdlets for managing Partner Center resources.' + + # Minimum version of the Windows PowerShell engine required by this module + PowerShellVersion = '5.0' + + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + DotNetFrameworkVersion = '4.6.1' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + CLRVersion = '4.0' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + #RequiredModules = @() + + # Assemblies that must be loaded prior to importing this module + RequiredAssemblies = '.\Microsoft.Store.PartnerCenter.PowerShell.dll', + '.\Microsoft.IdentityModel.Clients.ActiveDirectory.dll', + '.\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll', + '.\Microsoft.Store.PartnerCenter.dll', + '.\Microsoft.Store.PartnerCenter.Extensions.dll', + '.\Microsoft.Store.PartnerCenter.Models.dll', + '.\Newtonsoft.Json.dll' + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = 'Microsoft.Store.PartnerCenter.PowerShell.types.ps1xml' + + # Format files (.ps1xml) to be loaded when importing this module + FormatsToProcess = 'Microsoft.Store.PartnerCenter.PowerShell.format.ps1xml' + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + NestedModules = @('Microsoft.Store.PartnerCenter.PowerShell.dll') + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @() + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = '*' + + # Variables to export from this module + # VariablesToExport = @() + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @() + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + PSData = @{ + # Tags applied to this module. These help with module discovery in online galleries. + Tags = 'CSP','Partner Center','Azure','Office 365' + + # A URL to the license for this module. + LicenseUri = 'https://raw.githubusercontent.com/Microsoft/Partner-Center-PowerShell/master/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/Microsoft/Partner-Center-PowerShell' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + ReleaseNotes = '' + + # Prerelease string of this module + Prerelease = 'preview' + + # Flag to indicate whether the module requires explicit user acceptance for install/update + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + + } # End of PSData hashtable + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' +} \ No newline at end of file diff --git a/src/PowerShell/PowerShell.csproj b/src/PowerShell/PowerShell.csproj new file mode 100644 index 0000000..d4de76e --- /dev/null +++ b/src/PowerShell/PowerShell.csproj @@ -0,0 +1,262 @@ + + + + + + + + + Debug + AnyCPU + {6714CA29-04A6-4D4E-919C-28AF294E6BA6} + Library + Properties + Microsoft.Store.PartnerCenter.PowerShell + Microsoft.Store.PartnerCenter.PowerShell + v4.6.1 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + MinimumRecommendedRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + false + + + + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.29.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.29.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + + ..\..\packages\Microsoft.Store.PartnerCenter.1.9.0\lib\Net45\Microsoft.Store.PartnerCenter.dll + + + ..\..\packages\Microsoft.Store.PartnerCenter.1.9.0\lib\Net45\Microsoft.Store.PartnerCenter.Extensions.dll + + + ..\..\packages\Microsoft.Store.PartnerCenter.1.9.0\lib\Net45\Microsoft.Store.PartnerCenter.Models.dll + + + ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + + + + ..\..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + + PreserveNewest + Designer + + + + PreserveNewest + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/src/PowerShell/Properties/AssemblyInfo.cs b/src/PowerShell/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..238b9d1 --- /dev/null +++ b/src/PowerShell/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft Partner Center PowerShell")] +[assembly: AssemblyDescription("PowerShell module for managing Partner Center resources.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Partner Center PowerShell")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6714ca29-04a6-4d4e-919c-28af294e6ba6")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.1808.09.3")] +[assembly: AssemblyFileVersion("0.1808.09.3")] +[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/src/PowerShell/Properties/Resources.Designer.cs b/src/PowerShell/Properties/Resources.Designer.cs new file mode 100644 index 0000000..b53a56b --- /dev/null +++ b/src/PowerShell/Properties/Resources.Designer.cs @@ -0,0 +1,369 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Store.PartnerCenter.PowerShell.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Store.PartnerCenter.PowerShell.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Adds a new line item to the cart with the identifier of {0}.. + /// + internal static string AddPartnerCustomerCartLineItemWhatIf { + get { + return ResourceManager.GetString("AddPartnerCustomerCartLineItemWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} must be greater than zero. + /// + internal static string AssertNumberPositiveInvalidError { + get { + return ResourceManager.GetString("AssertNumberPositiveInvalidError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to number. + /// + internal static string AssertNumberPositiveInvalidPrefix { + get { + return ResourceManager.GetString("AssertNumberPositiveInvalidPrefix", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not set. + /// + internal static string AssertStringNotEmptyInvalidError { + get { + return ResourceManager.GetString("AssertStringNotEmptyInvalidError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to string. + /// + internal static string AssertStringNotEmptyInvalidPrefix { + get { + return ResourceManager.GetString("AssertStringNotEmptyInvalidPrefix", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Audit records are only available for the past 90 days. Please update the start date parameter and try again.. + /// + internal static string AuditRecordDateError { + get { + return ResourceManager.GetString("AuditRecordDateError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Checks out the cart with the identifier of {0}.. + /// + internal static string CheckoutPartnerCustomerCartWhatIf { + get { + return ResourceManager.GetString("CheckoutPartnerCustomerCartWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to City is a required feild. Please update the input and try again.. + /// + internal static string CityRequiredError { + get { + return ResourceManager.GetString("CityRequiredError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The domain {0} already exists. Please modify the domain value and try again.. + /// + internal static string DomainExistsError { + get { + return ResourceManager.GetString("DomainExistsError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An invalid environment name was specified.. + /// + internal static string InvalidEnvironmentException { + get { + return ResourceManager.GetString("InvalidEnvironmentException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not a valid phone number format. Please update the input and try again.. + /// + internal static string InvalidPhoneFormatError { + get { + return ResourceManager.GetString("InvalidPhoneFormatError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The CustomerId parameter must be set or a customer object must be passed from the pipeline.. + /// + internal static string InvalidSetCustomerIdentifierException { + get { + return ResourceManager.GetString("InvalidSetCustomerIdentifierException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The UserId parameter must be set or a customer user object must be passed from the pipeline.. + /// + internal static string InvalidSetCustomerUserIdentifierException { + get { + return ResourceManager.GetString("InvalidSetCustomerUserIdentifierException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} is not valid entry for the state field. The valid values are {1}. Please update the input and try again.. + /// + internal static string InvalidStateError { + get { + return ResourceManager.GetString("InvalidStateError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new cart for the customer with the identifier of {0}.. + /// + internal static string NewCartWhatIf { + get { + return ResourceManager.GetString("NewCartWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Accepts the specified agreement for the customer.. + /// + internal static string NewPartnerCustomerAgreementWhatIf { + get { + return ResourceManager.GetString("NewPartnerCustomerAgreementWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new cart line item in memory.. + /// + internal static string NewPartnerCustomerCartLineItemWhatIf { + get { + return ResourceManager.GetString("NewPartnerCustomerCartLineItemWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new customer configuration policy.. + /// + internal static string NewPartnerCustomerConfigurationPolicyWhatIf { + get { + return ResourceManager.GetString("NewPartnerCustomerConfigurationPolicyWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new customer order line item in memory.. + /// + internal static string NewPartnerCustomerOrderLineItemWhatIf { + get { + return ResourceManager.GetString("NewPartnerCustomerOrderLineItemWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new customer user with the user principal name of {0}.. + /// + internal static string NewPartnerCustomerUserWhatIf { + get { + return ResourceManager.GetString("NewPartnerCustomerUserWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new {0} as a new customer.. + /// + internal static string NewPartnerCustomerWhatIf { + get { + return ResourceManager.GetString("NewPartnerCustomerWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Postal code is a required field. Please update the input and try again.. + /// + internal static string PostalCoderequiredError { + get { + return ResourceManager.GetString("PostalCoderequiredError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removes the configuration policy with the identifer of {0}.. + /// + internal static string RemovePartnerCustomerConfigurationPolicyWhatIf { + get { + return ResourceManager.GetString("RemovePartnerCustomerConfigurationPolicyWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deletes the customer user account with the identifier of {0}.. + /// + internal static string RemovePartnerCustomerUserWhatIf { + get { + return ResourceManager.GetString("RemovePartnerCustomerUserWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deletes the customer with the identifier of {0} from the integration sandbox.. + /// + internal static string RemovePartnerSandboxCustomer { + get { + return ResourceManager.GetString("RemovePartnerSandboxCustomer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restores the customer user account with the identifier of {0}.. + /// + internal static string RestorePartnerCustomerUserWhatIf { + get { + return ResourceManager.GetString("RestorePartnerCustomerUserWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Run Connect-PartnerCenter to login.. + /// + internal static string RunConnectPartnerCenter { + get { + return ResourceManager.GetString("RunConnectPartnerCenter", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updates the configuration policy with the identifer of {0}.. + /// + internal static string SetPartnerCustomerConfigurationPolicyWhatIf { + get { + return ResourceManager.GetString("SetPartnerCustomerConfigurationPolicyWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updates the subscription {0} that belongs to the customer with the identifier of {1}.. + /// + internal static string SetPartnerCustomerSubscriptionWhatIf { + get { + return ResourceManager.GetString("SetPartnerCustomerSubscriptionWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updates the specified customer user information for a user with the identifier of {0}.. + /// + internal static string SetPartnerCustomerUserWhatIf { + get { + return ResourceManager.GetString("SetPartnerCustomerUserWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updates the billing profile for {0}.. + /// + internal static string SetPartnerCustomerWhatIf { + get { + return ResourceManager.GetString("SetPartnerCustomerWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updates the partner's legal business profile.. + /// + internal static string SetPartnerLegalProfileWhatIf { + get { + return ResourceManager.GetString("SetPartnerLegalProfileWhatIf", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to State is a required feild. Please update the input and try again.. + /// + internal static string StateRequiredError { + get { + return ResourceManager.GetString("StateRequiredError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Registers the subscription {0} owned by the customer with the identifier of {1}.. + /// + internal static string SubscriptionRegistrationWhatIf { + get { + return ResourceManager.GetString("SubscriptionRegistrationWhatIf", resourceCulture); + } + } + } +} diff --git a/src/PowerShell/Properties/Resources.resx b/src/PowerShell/Properties/Resources.resx new file mode 100644 index 0000000..8ac93ef --- /dev/null +++ b/src/PowerShell/Properties/Resources.resx @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Adds a new line item to the cart with the identifier of {0}. + + + {0} must be greater than zero + + + number + + + {0} is not set + + + string + + + Audit records are only available for the past 90 days. Please update the start date parameter and try again. + + + Checks out the cart with the identifier of {0}. + + + City is a required feild. Please update the input and try again. + + + The domain {0} already exists. Please modify the domain value and try again. + + + An invalid environment name was specified. + + + {0} is not a valid phone number format. Please update the input and try again. + + + The CustomerId parameter must be set or a customer object must be passed from the pipeline. + + + The UserId parameter must be set or a customer user object must be passed from the pipeline. + + + {0} is not valid entry for the state field. The valid values are {1}. Please update the input and try again. + + + Creates a new cart for the customer with the identifier of {0}. + + + Accepts the specified agreement for the customer. + + + Creates a new cart line item in memory. + + + Creates a new customer configuration policy. + + + Creates a new customer order line item in memory. + + + Creates a new customer user with the user principal name of {0}. + + + Creates a new {0} as a new customer. + + + Postal code is a required field. Please update the input and try again. + + + Removes the configuration policy with the identifer of {0}. + + + Deletes the customer user account with the identifier of {0}. + + + Deletes the customer with the identifier of {0} from the integration sandbox. + + + Restores the customer user account with the identifier of {0}. + + + Run Connect-PartnerCenter to login. + + + Updates the configuration policy with the identifer of {0}. + + + Updates the subscription {0} that belongs to the customer with the identifier of {1}. + + + Updates the specified customer user information for a user with the identifier of {0}. + + + Updates the billing profile for {0}. + + + Updates the partner's legal business profile. + + + State is a required feild. Please update the input and try again. + + + Registers the subscription {0} owned by the customer with the identifier of {1}. + + \ No newline at end of file diff --git a/src/PowerShell/Validations/AddressValidator.cs b/src/PowerShell/Validations/AddressValidator.cs new file mode 100644 index 0000000..3ff929c --- /dev/null +++ b/src/PowerShell/Validations/AddressValidator.cs @@ -0,0 +1,114 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Validations +{ + using System.Globalization; + using System.Linq; + using System.Text.RegularExpressions; + using Common; + using PartnerCenter.Exceptions; + using PartnerCenter.Models; + using PartnerCenter.Models.CountryValidationRules; + using Properties; + + public sealed class AddressValidator : IValidator
+ { + /// + /// Provides the ability to interact with Partner Center. + /// + private readonly IPartner partner; + + /// + /// Initializes a new instance of the class. + /// + /// Provides the ability interact with Partner Center. + /// + /// is null. + /// + public AddressValidator(IPartner partner) + { + partner.AssertNotNull(nameof(partner)); + this.partner = partner; + } + + /// + /// Determines if the resource is valid. + /// + /// The resource to be validate. + /// true if the resource is valid; otherwise false. + public bool IsValid(Address resource) + { + CountryValidationRules validationRules; + + resource.AssertNotNull(nameof(resource)); + + try + { + validationRules = partner.CountryValidationRules.ByCountry(resource.Country).Get(); + + if (validationRules.IsCityRequired) + { + if (string.IsNullOrEmpty(resource.City)) + { + throw new ValidationException(Resources.CityRequiredError); + } + } + + if (validationRules.IsPostalCodeRequired) + { + if (string.IsNullOrEmpty(resource.PostalCode)) + { + throw new ValidationException(Resources.PostalCoderequiredError); + } + } + + if (validationRules.IsStateRequired) + { + if (string.IsNullOrEmpty(resource.State)) + { + throw new ValidationException(Resources.StateRequiredError); + } + else + { + if (!validationRules.SupportedStatesList.Contains(resource.State)) + { + throw new ValidationException( + string.Format( + CultureInfo.CurrentCulture, + Resources.InvalidStateError, + resource.State, + string.Join(",", validationRules.SupportedStatesList))); + } + } + } + + if (!string.IsNullOrEmpty(validationRules.PhoneNumberRegex) && !string.IsNullOrEmpty(resource.PhoneNumber)) + { + if (!Regex.Match(resource.PhoneNumber, validationRules.PhoneNumberRegex).Success) + { + throw new ValidationException( + string.Format( + CultureInfo.CurrentCulture, + Resources.InvalidPhoneFormatError, + resource.PhoneNumber)); + } + } + + return partner.Validations.IsAddressValid(resource); + } + catch (PartnerException) + { + // TODO - Handle the parsing of the exception. + return false; + } + finally + { + validationRules = null; + } + } + } +} \ No newline at end of file diff --git a/src/PowerShell/Validations/IValidator.cs b/src/PowerShell/Validations/IValidator.cs new file mode 100644 index 0000000..4cf4051 --- /dev/null +++ b/src/PowerShell/Validations/IValidator.cs @@ -0,0 +1,13 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Validations +{ + public interface IValidator + { + bool IsValid(T resource); + } +} \ No newline at end of file diff --git a/src/PowerShell/Validations/ValidationException.cs b/src/PowerShell/Validations/ValidationException.cs new file mode 100644 index 0000000..6215e4d --- /dev/null +++ b/src/PowerShell/Validations/ValidationException.cs @@ -0,0 +1,51 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Validations +{ + using System; + using System.Management.Automation; + using System.Runtime.Serialization; + + [Serializable] + public class ValidationException : PSInvalidOperationException + { + /// + /// Initializes a new instance of the class. + /// + public ValidationException() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The message that describes the error. + public ValidationException(string message) : base(message) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. + /// + public ValidationException(string message, Exception innerException) : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + protected ValidationException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file diff --git a/src/PowerShell/app.config b/src/PowerShell/app.config new file mode 100644 index 0000000..31fa8ec --- /dev/null +++ b/src/PowerShell/app.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/PowerShell/packages.config b/src/PowerShell/packages.config new file mode 100644 index 0000000..340e0c2 --- /dev/null +++ b/src/PowerShell/packages.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/AnalyticTests.cs b/test/PowerShell.Tests/Commands/AnalyticTests.cs new file mode 100644 index 0000000..7755ed2 --- /dev/null +++ b/test/PowerShell.Tests/Commands/AnalyticTests.cs @@ -0,0 +1,55 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using Microsoft.Store.PartnerCenter.Models; + using Microsoft.Store.PartnerCenter.Models.Analytics; + using Microsoft.Store.PartnerCenter.PowerShell.Authentication; + using Microsoft.Store.PartnerCenter.PowerShell.Tests.Factories; + using Moq; + using VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class AnalyticTests : TestBase + { + /// + /// Unit test for the Get-PartnerLicenseDeploymentInformation cmdlet. + /// + [TestMethod] + public void GetPartnerLicenseDeploymentInformationTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerLicenseDeploymentInformation"); + } + + /// + /// Unit test for the Get-GetPartnerLicenseUsageInformation cmdlet. + /// + [TestMethod] + public void GetPartnerLicenseUsageInformationTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerLicenseUsageInformation"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.Analytics.Licenses.Deployment.Get()).Returns( + OperationFactory.Instance.GetResource>("GetPartnerLicenseDeploymentInsights")); + + partnerOperations.Setup(p => p.Analytics.Licenses.Usage.Get()).Returns( + OperationFactory.Instance.GetResource>("GetPartnerLicensesUsageInsights")); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/AnalyticTests.ps1 b/test/PowerShell.Tests/Commands/AnalyticTests.ps1 new file mode 100644 index 0000000..9fc4ec5 --- /dev/null +++ b/test/PowerShell.Tests/Commands/AnalyticTests.ps1 @@ -0,0 +1,21 @@ +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerLicenseDeploymentInformation cmdlet. +#> +function Test-GetPartnerLicenseDeploymentInformation +{ + $deploymentInfo = Get-PartnerLicenseDeploymentInfo + + Assert-NotNull $deploymentInfo +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerLicenseUsageInformation cmdlet. +#> +function Test-GetPartnerLicenseUsageInformation +{ + $usageInfo = Get-PartnerLicenseUsageInfo + + Assert-NotNull $usageInfo +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/AuditRecordTests.cs b/test/PowerShell.Tests/Commands/AuditRecordTests.cs new file mode 100644 index 0000000..8145ec1 --- /dev/null +++ b/test/PowerShell.Tests/Commands/AuditRecordTests.cs @@ -0,0 +1,65 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using System; + using System.Management.Automation; + using Authentication; + using Enumerators; + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.Auditing; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available audit record cmdlets. + /// + [TestClass] + public class AuditRecordTests : TestBase + { + /// + /// Unit test for the Get-PartnerAuditRecord cmdlet. + /// + [TestMethod] + public void GetPartnerAuditRecordTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerAuditRecord"); + } + + /// + /// Unit test for the Get-PartnerAuditRecord cmdlet. + /// + [ExpectedException(typeof(CmdletInvocationException))] + [TestMethod] + public void GetPartnerAuditRecordInvalidDateTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerAuditRecordInvalidDateTest"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.AuditRecords.Query(It.IsAny(), null, null)).Returns( + OperationFactory.Instance.GetResource>("GetAuditRecord")); + + // Enumerator Operations + partnerOperations.Setup(p => p.Enumerators.AuditRecords.Create(It.IsAny>())) + .Returns( + new ResourceCollectionEnumerator>( + OperationFactory.Instance.GetResource>("GetAuditRecord"))); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/AuditRecordTests.ps1 b/test/PowerShell.Tests/Commands/AuditRecordTests.ps1 new file mode 100644 index 0000000..e213143 --- /dev/null +++ b/test/PowerShell.Tests/Commands/AuditRecordTests.ps1 @@ -0,0 +1,17 @@ +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerAuditRecord cmdlet. +#> +function Test-GetPartnerAuditRecord +{ + Get-PartnerAuditRecord -StartDate (Get-Date).AddDays(-7) +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerAuditRecord cmdlet. +#> +function Test-GetPartnerAuditRecordInvalidDateTest +{ + Get-PartnerAuditRecord -StartDate (Get-Date).AddDays(-100) +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/Common.ps1 b/test/PowerShell.Tests/Commands/Common.ps1 new file mode 100644 index 0000000..7f23a60 --- /dev/null +++ b/test/PowerShell.Tests/Commands/Common.ps1 @@ -0,0 +1,65 @@ +<# +.SYNOPSIS +Verifies that two given objects are equal. +#> +function Assert-AreEqual +{ + param([object] $expected, [object] $actual, [string] $message) + + if (!$message) + { + $message = "Assertion failed because expected '$expected' does not match actual '$actual'" + } + + if ($expected -ne $actual) + { + throw $message + } + + return $true +} + +<# +.SYNOPSIS +Validates that the given scriptblock returns false. +#> +function Assert-False +{ + param([ScriptBlock]$script, [string]$message) + + if (!$message) + { + $message = "Assertion failed: " + $script + } + + $result = &$script + + if ($result) + { + throw $message + } + + return $true +} + +<# +.SYNOPSIS +Validates a string is not null. +#> +function Assert-NotNull +{ + param($value) + + Assert-False { $null -eq $value } +} + +<# +.SYNOPSIS +Validates a string is not null or empty. +#> +function Assert-NotNullOrEmpty +{ + param([string]$value) + + Assert-False { [string]::IsNullOrEmpty($value) } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/CustomerTests.cs b/test/PowerShell.Tests/Commands/CustomerTests.cs new file mode 100644 index 0000000..4c030cb --- /dev/null +++ b/test/PowerShell.Tests/Commands/CustomerTests.cs @@ -0,0 +1,375 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using System.Collections.Generic; + using Authentication; + using Enumerators; + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.CountryValidationRules; + using PartnerCenter.Models.Customers; + using PartnerCenter.Models.DevicesDeployment; + using PartnerCenter.Models.Entitlements; + using PartnerCenter.Models.Licenses; + using PartnerCenter.Models.ManagedServices; + using PartnerCenter.Models.Query; + using PartnerCenter.Models.Roles; + using PartnerCenter.Models.Subscriptions; + using PartnerCenter.Models.Users; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available customer cmdlets. + /// + [TestClass] + public class CustomerTests : TestBase + { + /// + /// Unit test for the Get-PartnerCustomer cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomer"); + } + + /// + /// Unit test for the Get-PartnerCustomerEntitlement cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerEntitlementTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerEntitlement"); + } + + /// + /// Unit test for the Get-PartnerCustomerSubscription cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerSubscriptionTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerSubscription"); + } + + /// + /// Unit test for the New-PartnerCustomer cmdlet. + /// + [TestMethod] + public void NewPartnerCustomerTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-NewPartnerCustomer"); + } + + /// + /// Unit test for the Set-PartnerCustomer cmdlet. + /// + [TestMethod] + public void SetPartnerCustomerTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-SetPartnerCustomer"); + } + + /// + /// Unit test for the Set-PartnerCustomerUser cmdlet. + /// + [TestMethod] + public void SetPartnerCustomerUserTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-SetPartnerCustomerUser"); + } + + /// + /// Unit test for the Get-PartnerCustomerDevice cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerDeviceTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerDevice"); + } + + /// + /// Unit test for the Get-PartnerCustomerDeviceBatch cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerDeviceBatchTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerDeviceBatch"); + } + + /// + /// Unit test for the Get-PartnerCustomerLicense cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerLicenseTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerLicense"); + } + + /// + /// Unit test for the Get-PartnerCustomerManagedService cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerManagedServiceTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerManagedService"); + } + + /// + /// Unit test for the Get-PartnerCustomerUser cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerUserTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerUser"); + } + + /// + /// Unit test for the Remove-PartnerCustomerUser cmdlet. + /// + [TestMethod] + public void RemovePartnerCustomerUserTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-RemovePartnerCustomerUser"); + } + + /// + /// Unit test for the Restore-PartnerCustomerUser cmdlet. + /// + [TestMethod] + public void RestorePartnerCustomerUserTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-RestorePartnerCustomerUser"); + } + + /// + /// Unit test for the New-PartnerCustomerUser cmdlet. + /// + [TestMethod] + public void NewPartnerCustomerUserTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-NewPartnerCustomerUser"); + } + + /// + /// Unit test for the Get-PartnerCustomerUserRole cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerUserRoleTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerUserRole"); + } + + /// + /// Unit test for the Add-PartnerCustomerUserRoleMember cmdlet. + /// + [TestMethod] + public void AddPartnerCustomerUserRoleMemberTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-AddPartnerCustomerUserRoleMember"); + } + + /// + /// Unit test for the Remove-PartnerCustomerUserRoleMember cmdlet. + /// + [TestMethod] + public void RemovePartnerCustomerUserRoleMemberTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-RemovePartnerCustomerUserRoleMember"); + } + + /// + /// Unit test for the Get-PartnerCustomerConfigurationPolicy cmdlet. + /// + [TestMethod] + public void GetPartnerCustomerConfigurationPolicyTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerCustomerConfigurationPolicy"); + } + + /// + /// Unit test for the Remove-PartnerSandboxCustomer cmdlet. + /// + [TestMethod] + public void RemovePartnerSandboxCustomerTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-RemovePartnerSandboxCustomer"); + } + + /// + /// Unit test for the Set-PartnerCustomerConfigurationPolicy cmdlet. + /// + [TestMethod] + public void SetPartnerCustomerConfigurationPolicyTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-SetPartnerCustomerConfigurationPolicy"); + } + + /// + /// Unit test for the New-PartnerCustomerConfigurationPolicy cmdlet. + /// + [TestMethod] + public void NewPartnerCustomerConfigurationPolicyTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-NewPartnerCustomerConfigurationPolicy"); + } + + /// + /// Unit test for the Remove-PartnerCustomerConfigurationPolicy cmdlet. + /// + [TestMethod] + public void RemovePartnerCustomerConfigurationPolicyTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-RemovePartnerCustomerConfigurationPolicy"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + // Country Valiation Operations + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("US").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-US")); + + // Customer Operations + partnerOperations.Setup(p => p.Customers.Create(It.IsAny())) + .Returns(OperationFactory.Instance.GetNewCustomer()); + partnerOperations.Setup(p => p.Customers.Get()).Returns(OperationFactory.Instance.GetCustomers()); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Get()) + .Returns(OperationFactory.Instance.GetCustomer()); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Get()) + .Returns(OperationFactory.Instance.GetCustomer()); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Profiles.Billing.Update(It.IsAny())). + Returns(OperationFactory.Instance.GetCustomerBillingProfile()); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Profiles.Billing.Update(It.IsAny())). + Returns(OperationFactory.Instance.GetCustomerBillingProfile()); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Entitlements.Get()). + Returns(OperationFactory.Instance.GetResource>("GetEntitlement")); + + // Delete Operations + partnerOperations.Setup(p => p.Customers[It.IsAny()].Delete()).Verifiable(); + + // Domain Operations + partnerOperations.Setup(p => p.Domains.ByDomain(It.IsAny()).Exists()).Returns(false); + + + // Enumerator Operations + partnerOperations.Setup(p => p.Enumerators.Customers.Create(It.IsAny>())) + .Returns(new ResourceCollectionEnumerator>(OperationFactory.Instance.GetCustomers())); + + // Managed Service Operations + partnerOperations.Setup(p => p.Customers[It.IsAny()].ManagedServices.Get()).Returns( + OperationFactory.Instance.GetResource>("GetCustomerManagedServices")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).ManagedServices.Get()).Returns( + OperationFactory.Instance.GetResource>("GetCustomerManagedServices")); + + // Subscription Operations + partnerOperations.Setup(p => p.Customers[It.IsAny()].Subscriptions.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerSubscription")); + + // Validation Operations + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + + // Device Operations + partnerOperations.Setup(p => p.Customers[It.IsAny()].DeviceBatches.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerDeviceBatch")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].DeviceBatches[It.IsAny()].Devices.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerDevice")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].DeviceBatches.ById(It.IsAny()).Devices.Get()) + .Returns(OperationFactory.Instance.GetResource>("GetCustomerDevice")); + + // License Operations + List licenseGroupIds = new List() { LicenseGroupId.Group1 }; + + partnerOperations.Setup(p => p.Customers[It.IsAny()].SubscribedSkus.Get(licenseGroupIds)). + Returns(OperationFactory.Instance.GetResource>("GetCustomerLicenseByGroup")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).SubscribedSkus.Get(licenseGroupIds)). + Returns(OperationFactory.Instance.GetResource>("GetCustomerLicenseByGroup")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].SubscribedSkus.Get(null)). + Returns(OperationFactory.Instance.GetResource>("GetCustomerLicense")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).SubscribedSkus.Get(null)). + Returns(OperationFactory.Instance.GetResource>("GetCustomerLicense")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.ById(It.IsAny()).Licenses.Get(null)). + Returns(OperationFactory.Instance.GetResource>("GetCustomerLicenseUser")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users[It.IsAny()].Licenses.Get(null)). + Returns(OperationFactory.Instance.GetResource>("GetCustomerLicenseUser")); + + // User Operations + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserAll")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserAll")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users.Query(It.IsAny())). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserAllDeleted")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.Query(It.IsAny())). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserAllDeleted")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users[It.IsAny()].Get()). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.ById(It.IsAny()).Get()). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + partnerOperations.Setup(p => p.Enumerators.CustomerUsers.Create(It.IsAny>())). + Returns(new ResourceCollectionEnumerator>(OperationFactory.Instance.GetResource>("GetCustomerUserAll"))); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users[It.IsAny()].Patch(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.ById(It.IsAny()).Patch(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users[It.IsAny()].Patch(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users.Create(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.Create(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerUserById")); + + // Customer User role operations + partnerOperations.Setup(p => p.Customers[It.IsAny()].Users[It.IsAny()].DirectoryRoles.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserRoleById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).Users.ById(It.IsAny()).DirectoryRoles.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserRoleById")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].DirectoryRoles.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserRoleById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).DirectoryRoles.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerUserRoleById")); + + // Customer User Role operations + partnerOperations.Setup(p => p.Customers[It.IsAny()].DirectoryRoles[It.IsAny()].UserMembers.Create(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("AddCustomerUserRoleMember")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).DirectoryRoles.ById(It.IsAny()).UserMembers.Create(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("AddCustomerUserRoleMember")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].DirectoryRoles[It.IsAny()].UserMembers[It.IsAny()].Delete()); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).DirectoryRoles.ById(It.IsAny()).UserMembers.ById(It.IsAny()).Delete()); + + // Customer Configuration Policy + partnerOperations.Setup(p => p.Customers[It.IsAny()].ConfigurationPolicies.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerConfigurationPolicies")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].ConfigurationPolicies.Get()). + Returns(OperationFactory.Instance.GetResource>("GetCustomerConfigurationPolicies")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].ConfigurationPolicies[It.IsAny()].Get()). + Returns(OperationFactory.Instance.GetResource("GetCustomerConfigurationPolicyById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).ConfigurationPolicies.ById(It.IsAny()).Get()). + Returns(OperationFactory.Instance.GetResource("GetCustomerConfigurationPolicyById")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].ConfigurationPolicies[It.IsAny()].Patch(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerConfigurationPolicyById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).ConfigurationPolicies.ById(It.IsAny()).Patch(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerConfigurationPolicyById")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].ConfigurationPolicies.Create(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerConfigurationPolicyById")); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).ConfigurationPolicies.Create(It.IsAny())). + Returns(OperationFactory.Instance.GetResource("GetCustomerConfigurationPolicyById")); + partnerOperations.Setup(p => p.Customers[It.IsAny()].ConfigurationPolicies[It.IsAny()].Delete()); + partnerOperations.Setup(p => p.Customers.ById(It.IsAny()).ConfigurationPolicies.ById(It.IsAny()).Delete()); + + // Return everything + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/CustomerTests.ps1 b/test/PowerShell.Tests/Commands/CustomerTests.ps1 new file mode 100644 index 0000000..8c5bf81 --- /dev/null +++ b/test/PowerShell.Tests/Commands/CustomerTests.ps1 @@ -0,0 +1,300 @@ +$ContosoCustomerId = "46a62ece-10ad-42e5-b3f1-b2ed53e6fc08" +$ContosoUserId = "6e668259-1f09-479d-bcb8-d9b03e826b8d" +$ContosoUserPrincipalName = "admin@dtdemocspcustomer005.onmicrosoft.com" +$p = "P@rtn34C3nt3rT3st" | ConvertTo-SecureString -AsPlainText -Force + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomer cmdlet. +#> +function Test-GetPartnerCustomer +{ + $customers = Get-PartnerCustomer + Assert-NotNull $customers + + $customer = Get-PartnerCustomer -CustomerId $ContosoCustomerId + Assert-NotNullOrEmpty $customer.CustomerId 'CustomerId should not be null' + Assert-NotNullOrEmpty $customer.Domain 'Domain should not be null' + Assert-NotNullOrEmpty $customer.Name 'Name should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerEntitlement cmdlet. +#> +function Test-GetPartnerCustomerEntitlement +{ + $entitlement = Get-PartnerCustomerEntitlement -CustomerId $ContosoCustomerId + Assert-NotNull $entitlement + Assert-NotNullOrEmpty $entitlement[0].ProductId +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerManagedService cmdlet. +#> + +function Test-GetPartnerCustomerManagedService +{ + $links = Get-PartnerCustomerManagedService $ContosoCustomerId + Assert-NotNull $links + Assert-NotNullOrEmpty $links[0].ManagedServiceId +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerSubscription cmdlet. +#> +function Test-GetPartnerCustomerSubscription +{ + $customer = Get-PartnerCustomer -CustomerId $ContosoCustomerId + $subscriptions = $customer | Get-PartnerCustomerSubscription + Assert-NotNull $subscriptions + Assert-NotNullOrEmpty $subscriptions[0].FriendlyName +} + +<# +.SYNOPSIS +Tests to be performed using the New-PartnerCustomer cmdlet. +#> +function Test-NewPartnerCustomer +{ + $newCustomer = New-PartnerCustomer -BillingAddressLine1 "12012 Sunset Hills Rd" ` + -BillingAddressCity "Reston" ` + -BillingAddressCountry "US" ` + -BillingAddressPostalCode "20190" ` + -BillingAddressState "VA" ` + -ContactEmail "hugh@tailspintoys.com" ` + -ContactFirstName "Hugh" ` + -ContactLastName "Williams" ` + -ContactPhoneNumber "703-673-7676" ` + -Culture "en-US" ` + -Domain "tailspintoys.onmicrosoft.com" ` + -Language "en" ` + -Name "TailSpin Toys" + + Assert-NotNull $newCustomer +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerCustomer cmdlet. +#> +function Test-SetPartnerCustomer +{ + $customer = Get-PartnerCustomer -CustomerId $ContosoCustomerId + $customer | Set-PartnerCustomer -BillingAddressLine1 "123" -BillingAddressLine2 "456" + Set-PartnerCustomer -BillingAddressLine1 "123" -BillingAddressLine2 "456" -CustomerId $ContosoCustomerId +} + + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerCustomerDeviceBatch cmdlet. +#> +function Test-GetPartnerCustomerDeviceBatch +{ + $customer = Get-PartnerCustomer -CustomerId $ContosoCustomerId + + $DeviceBatch = Get-PartnerCustomerDeviceBatch $ContosoCustomerId + Assert-NotNull $DeviceBatch + Assert-NotNullOrEmpty $DeviceBatch[0].BatchId 'BatchId should not be null' + Assert-NotNullOrEmpty $DeviceBatch[0].DevicesCount 'DevicesCount should not be null' + Assert-NotNullOrEmpty $DeviceBatch[0].CreationDate 'CreationDate should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerCustomerDevice cmdlet. +#> +function Test-GetPartnerCustomerDevice +{ + $DeviceBatch = Get-PartnerCustomerDeviceBatch $ContosoCustomerId + $Device = Get-PartnerCustomerDevice -CustomerId $ContosoCustomerId -BatchId $DeviceBatch[0].BatchId + Assert-NotNull $Device + Assert-NotNullOrEmpty $Device[0].SerialNumber 'SerialNumber should not be null' + Assert-NotNullOrEmpty $Device[0].ProductKey 'ProductKey should not be null' + Assert-NotNullOrEmpty $Device[0].OemManufacturerName 'OemManufacturerName should not be null' + Assert-NotNullOrEmpty $Device[0].UploadedDate 'UploadedDate should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerLicense cmdlet. +#> +function Test-GetPartnerCustomerLicense +{ + $Licenses = Get-PartnerCustomerLicense -CustomerId $ContosoCustomerId -LicenseGroupId "Group1" + Assert-NotNull $Licenses + Assert-NotNullOrEmpty $Licenses[0].ProductSku.Id 'ProductSku.Id should not be null' + + $Licenses = Get-PartnerCustomerLicense -CustomerId $ContosoCustomerId -UserId $ContosoUserId + Assert-NotNull $Licenses + Assert-NotNullOrEmpty $Licenses[0].ProductSku.Id 'ProductSku.Id should not be null' + Assert-NotNullOrEmpty $Licenses[0].ServicePlans.DisplayName[0] 'ServicePlans should not be null' + Assert-NotNullOrEmpty $Licenses[0].Name 'Name should not be null' + Assert-NotNullOrEmpty $Licenses[0].LicenseGroupId 'LicenseGroupId should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerUser cmdlet. +#> +function Test-GetPartnerCustomerUser +{ + $Users = Get-PartnerCustomerUser -CustomerId $ContosoCustomerId + Assert-NotNull $Users + Assert-NotNullOrEmpty $Users[0].UserId 'UserId should not be null' + + $UserUpn = $Users[0].UserPrincipalName + $DeletedUser = Get-PartnerCustomerUser -CustomerId $ContosoCustomerId -ReturnDeletedUsers + Assert-NotNull $DeletedUser + Assert-NotNullOrEmpty $DeletedUser[0].UserId 'UserId should not be null' + + $SpecificUser = Get-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserId $ContosoUserId + Assert-NotNull $SpecificUser + Assert-NotNull $SpecificUser[0].UserId "UserId should not be null" + + $SpecificUpnUser = Get-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserPrincipalName admin@dtdemocspcustomer005.onmicrosoft.com + Assert-NotNull $SpecificUpnUser + Assert-NotNullOrEmpty $SpecificUpnUser[0].UserId 'UserId should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerCustomerUser cmdlet. +#> +function Test-SetPartnerCustomerUser +{ + $SpecificUser = Get-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserId $ContosoUserId + Assert-NotNull $SpecificUser + + $UpdatedUser = Set-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserId $ContosoUserId -UserPrincipalName admin@dtdemocspcustomer005.onmicrosoft.com -LastName "Smith" + + $SpecificUser | Set-PartnerCustomerUser -CustomerId $ContosoCustomerId -FirstName "Testing" +} + +<# +.SYNOPSIS +Tests to be performed using the Remove-PartnerCustomerUser cmdlet. +#> +function Test-RemovePartnerCustomerUser +{ + Remove-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserId $ContosoUserId + Remove-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserPrincipalName $ContosoUserPrincipalName +} + +<# +.SYNOPSIS +Tests to be performed using the Restore-PartnerCustomerUser cmdlet. +#> +function Test-RestorePartnerCustomerUser +{ + Restore-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserId $ContosoUserId + Restore-PartnerCustomerUser -CustomerId $ContosoCustomerId -UserPrincipalName $ContosoUserPrincipalName +} + +<# +.SYNOPSIS +Tests to be performed using the New-PartnerCustomerUser cmdlet. +#> +function Test-NewPartnerCustomerUser +{ + $newCustomerUser = New-PartnerCustomerUser -FirstName "Tester" ` + -LastName "Testerson" ` + -DisplayName "Tester Testerson" ` + -Password $p ` + -UserPrincipalName "tester@tailspintoys.onmicrosoft.com" ` + -UsageLocation "US" ` + -CustomerId $ContosoCustomerId + + Assert-NotNull $newCustomerUser +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerUserRole cmdlet. +#> +function Test-GetPartnerCustomerUserRole +{ + $OneUserRole = Get-PartnerCustomerUserRole -CustomerId $ContosoCustomerId -UserId $ContosoUserId + Assert-NotNull $OneUserRole + + $AllUserRoles = Get-PartnerCustomerUserRole -CustomerId $ContosoCustomerId + Assert-NotNull $AllUserRoles +} + +<# +.SYNOPSIS +Tests to be performed using the Add-PartnerCustomerUserRoleMember cmdlet. +#> +function Test-AddPartnerCustomerUserRoleMember +{ + $AddSuccess = Add-PartnerCustomerUserRoleMember -CustomerId $ContosoCustomerId -UserId $ContosoUserId -RoleId 55c7ddb0-ee68-4535-b5d3-851c3dffd266 + Assert-AreEqual $AddSuccess $true +} + +<# +.SYNOPSIS +Tests to be performed using the Remove-PartnerCustomerUserRoleMember cmdlet. +#> +function Test-RemovePartnerCustomerUserRoleMember +{ + $RemSuccess = Remove-PartnerCustomerUserRoleMember -CustomerId $ContosoCustomerId -UserId $ContosoUserId -RoleId 55c7ddb0-ee68-4535-b5d3-851c3dffd266 + Assert-AreEqual $RemSuccess $true +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerCustomerConfigurationPolicy cmdlet. +#> +function Test-GetPartnerCustomerConfigurationPolicy +{ + $ConfigPolicies = Get-PartnerCustomerConfigurationPolicy -CustomerId $ContosoCustomerId + Assert-NotNull $ConfigPolicies + + $ConfigPolicy = Get-PartnerCustomerConfigurationPolicy -CustomerId $ContosoCustomerId -PolicyId 56edf752-ee77-4fd8-b7f5-df1f74a3a9ac + Assert-NotNull $ConfigPolicy +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerCustomerConfigurationPolicy cmdlet. +#> +function Test-SetPartnerCustomerConfigurationPolicy +{ + Set-PartnerCustomerConfigurationPolicy -CustomerId $ContosoCustomerId -PolicyId 56edf752-ee77-4fd8-b7f5-df1f74a3a9ac -Name "New Policy Name" + Set-PartnerCustomerConfigurationPolicy -CustomerId $ContosoCustomerId -PolicyId 56edf752-ee77-4fd8-b7f5-df1f74a3a9ac -SkipEula $true +} + +<# +.SYNOPSIS +Tests to be performed using the New-PartnerCustomerConfigurationPolicy cmdlet. +#> +function Test-NewPartnerCustomerConfigurationPolicy +{ + $newPolicy = New-PartnerCustomerConfigurationPolicy -CustomerId $ContosoCustomerId -Name "New Policy Name" -OobeUserNotLocalAdmin $true + Assert-NotNullOrEmpty $newPolicy +} + +<# +.SYNOPSIS +Tests to be performed using the New-PartnerCustomerConfigurationPolicy cmdlet. +#> +function Test-RemovePartnerCustomerConfigurationPolicy +{ + $remPolicy = Remove-PartnerCustomerConfigurationPolicy -CustomerId $ContosoCustomerId -PolicyId 56edf752-ee77-4fd8-b7f5-df1f74a3a9a +} + +<# +.SYNOPSIS +Tests to be performed using the Remove-PartnerSandboxCustomer cmdlet. +#> +function Test-RemovePartnerSandboxCustomer +{ + $removed = Remove-PartnerSandboxCustomer $ContosoCustomerId -Confirm:$false + Assert-AreEqual $removed $true + + Remove-PartnerSandboxCustomer -CustomerId $ContosoCustomerId -Confirm:$false + Assert-AreEqual $removed $true +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/DomainTests.cs b/test/PowerShell.Tests/Commands/DomainTests.cs new file mode 100644 index 0000000..f046dc6 --- /dev/null +++ b/test/PowerShell.Tests/Commands/DomainTests.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using Authentication; + using Moq; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available audit record cmdlets. + /// + [TestClass] + public class DomainTests : TestBase + { + /// + /// Unit test for the Get-PartnerAuditRecord cmdlet. + /// + [TestMethod] + public void TestPartnerDomainAvailabilityTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-TestPartnerDomainAvailability"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + public IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.Domains.ByDomain(It.IsAny()).Exists()).Returns(true); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/DomainTests.ps1 b/test/PowerShell.Tests/Commands/DomainTests.ps1 new file mode 100644 index 0000000..567dc21 --- /dev/null +++ b/test/PowerShell.Tests/Commands/DomainTests.ps1 @@ -0,0 +1,10 @@ +<# +.SYNOPSIS +Tests to be performed using the Test-PartnerDomainAvailability cmdlet. +#> +function Test-TestPartnerDomainAvailability +{ + $result = Test-PartnerDomainAvailability -Domain 'testdomain.onmicrosoft.com' + + Assert-AreEqual $result $false +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/IndirectTests.cs b/test/PowerShell.Tests/Commands/IndirectTests.cs new file mode 100644 index 0000000..4ba7c76 --- /dev/null +++ b/test/PowerShell.Tests/Commands/IndirectTests.cs @@ -0,0 +1,43 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using Authentication; + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.Relationships; + using VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class IndirectTests : TestBase + { + /// + /// Unit test for the Get-PartnerInvoice cmdlet. + /// + [TestMethod] + public void GetPartnerIndirectReseller() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerIndirectReseller"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.Relationships.Get(PartnerRelationshipType.IsIndirectCloudSolutionProviderOf)).Returns( + OperationFactory.Instance.GetResource>("GetIndirectResellers")); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/IndirectTests.ps1 b/test/PowerShell.Tests/Commands/IndirectTests.ps1 new file mode 100644 index 0000000..b788af8 --- /dev/null +++ b/test/PowerShell.Tests/Commands/IndirectTests.ps1 @@ -0,0 +1,11 @@ +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerIndirectReseller cmdlet. +#> +function Test-GetPartnerIndirectReseller +{ + $resellers = Get-PartnerIndirectReseller + + Assert-NotNull $resellers + Assert-NotNullOrEmpty $resellers[0].Name +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/InvoiceTests.cs b/test/PowerShell.Tests/Commands/InvoiceTests.cs new file mode 100644 index 0000000..c97afa5 --- /dev/null +++ b/test/PowerShell.Tests/Commands/InvoiceTests.cs @@ -0,0 +1,53 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using Authentication; + using Enumerators; + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.Invoices; + using VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class InvoiceTests : TestBase + { + /// + /// Unit test for the Get-PartnerInvoice cmdlet. + /// + [TestMethod] + public void GetPartnerInvoice() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerInvoice"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + // Enumerator Operations + partnerOperations.Setup(p => p.Enumerators.Invoices.Create(It.IsAny>())) + .Returns( + new ResourceCollectionEnumerator>( + OperationFactory.Instance.GetResource>("GetInvoice"))); + + // Invoice Operations + partnerOperations.Setup(p => p.Invoices.Get()).Returns( + OperationFactory.Instance.GetResource>("GetInvoice")); + partnerOperations.Setup(p => p.Invoices[It.IsAny()].Get()).Returns( + OperationFactory.Instance.GetResource("GetInvoiceById")); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/InvoiceTests.ps1 b/test/PowerShell.Tests/Commands/InvoiceTests.ps1 new file mode 100644 index 0000000..86597a4 --- /dev/null +++ b/test/PowerShell.Tests/Commands/InvoiceTests.ps1 @@ -0,0 +1,15 @@ +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerInvoice cmdlet. +#> +function Test-GetPartnerInvoice +{ + $invoice = Get-PartnerInvoice -InvoiceId 'D030001TFO' + + Assert-NotNull $invoice + + $invoices = Get-PartnerInvoice + + Assert-NotNull $invoices + Assert-NotNullOrEmpty $invoices[0].InvoiceId +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/OfferTests.cs b/test/PowerShell.Tests/Commands/OfferTests.cs new file mode 100644 index 0000000..f9444d5 --- /dev/null +++ b/test/PowerShell.Tests/Commands/OfferTests.cs @@ -0,0 +1,127 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using System.Collections.Generic; + using Authentication; + using Microsoft.Store.PartnerCenter.PowerShell.Tests.Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.Offers; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the offer resource cmdlets. + /// + [TestClass] + public class OfferTests : TestBase + { + /// + /// Unit test for the Get-PartnerOffer cmdlet. + /// + [TestMethod] + public void GetPartnerOfferTests() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerOffer"); + } + + /// + /// Unit test for the Get-PartnerOfferAddon cmdlet. + /// + [TestMethod] + public void GetPartnerOfferAddonTests() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerOfferAddon"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + public IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.Offers.ByCountry("US").ById("031C9E47-4802-4248-838E-778FB1D2CC05").Get()).Returns(GetOffer()); + partnerOperations.Setup(p => p.Offers.ByCountry("US").Get()).Returns(GetOffers()); + + partnerOperations.Setup(p => p.Offers.ByCountry(It.IsAny()).ById(It.IsAny()).AddOns.Get()).Returns( + OperationFactory.Instance.GetResource>("GetOfferAddon")); + + return partnerOperations.Object; + } + + /// + /// Gets a list of offers used for unit testing. + /// + /// A resource collection of offers used for unit testing. + private static ResourceCollection GetOffers() + { + List offers = new List + { + { + new Offer + { + Description = "Microsoft 365 Enterprise is a complete, intelligent solution, including Office 365, Windows 10 Enterprise, and Enterprise Mobility + Security, that empowers everyone to be creative and work together, securely.", + Id = "2b3b8d2d-10aa-4be4-b5fd-7f2feb0c3091", + IsAddOn = false, + IsTrial = false, + Name = "Microsoft 365 E3" + } + }, + { + new Offer + { + Description = "The Office suite for PC and Mac with apps for tablets and phones, plus email, instant messaging, HD video conferencing, 1 TB personal file storage and sharing. For organizations with up to 300 users.", + Id = "031C9E47-4802-4248-838E-778FB1D2CC05", + IsAddOn = false, + IsTrial = false, + Name = "Office 365 Business Premium" + } + }, + { + new Offer + { + Description = "An integrated product for SMBs to access productivity tools, manage their productivity platform, and protect data across devices. For organizations with up to 300 users.", + Id = "0FA9D6B6-5923-4B5D-B16E-B7EF0A69E1B7", + IsAddOn = false, + IsTrial = true, + Name = "Microsoft 365 Business Trial" + } + }, + { + new Offer + { + Description = "Provides rich insights on advanced threats, supports proactive defense against them, and integrates seamlessly with other Office 365 security features.", + Id = "EFE1183A-8FA0-4138-BF0A-5AE271AB6E3C", + IsAddOn = true, + IsTrial = false, + Name = "Office 365 Threat Intelligence" + } + } + }; + + return new ResourceCollection(offers); + } + + /// + /// Gets an offer for unit testing. + /// + /// An offer to be used for unit testing. + private static Offer GetOffer() + { + return new Offer + { + Description = "The Office suite for PC and Mac with apps for tablets and phones, plus email, instant messaging, HD video conferencing, 1 TB personal file storage and sharing. For organizations with up to 300 users.", + Id = "031C9E47-4802-4248-838E-778FB1D2CC05", + Name = "Office 365 Business Premium" + + }; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/OfferTests.ps1 b/test/PowerShell.Tests/Commands/OfferTests.ps1 new file mode 100644 index 0000000..263c60c --- /dev/null +++ b/test/PowerShell.Tests/Commands/OfferTests.ps1 @@ -0,0 +1,40 @@ +$O365BusinessPremiumOfferId = "031C9E47-4802-4248-838E-778FB1D2CC05" + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerOffer cmdlet. +#> +function Test-GetPartnerOffer +{ + $offers = Get-PartnerOffer -CountryCode US + + # This value should be two instead of four because the + # cmdlet will filter out any add-ons and trials by default. + Assert-AreEqual 2 $offers.Count + + $addOns = Get-PartnerOffer -CountryCode US -AddOn + Assert-AreEqual 1 $addOns.Count + + $trials = Get-PartnerOffer -CountryCode US -Trial + Assert-AreEqual 1 $trials.Count + + $offer = Get-PartnerOffer -CountryCode US -OfferId $O365BusinessPremiumOfferId + + Assert-NotNullOrEmpty $offer.Description 'Description should not be null' + Assert-NotNullOrEmpty $offer.OfferId 'Id should not be null' + Assert-NotNullOrEmpty $offer.Name 'Name should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerOfferAddon cmdlet. +#> +function Test-GetPartnerOfferAddon +{ + $addOns = Get-PartnerOfferAddon -OfferId '195416C1-3447-423A-B37B-EE59A99A19C4' + + Assert-NotNull $addOns + Assert-NotNullOrEmpty $addOns[0].Description + Assert-NotNullOrEmpty $addOns[0].Name + Assert-NotNullOrEmpty $addOns[0].OfferId +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/PartnerTests.cs b/test/PowerShell.Tests/Commands/PartnerTests.cs new file mode 100644 index 0000000..bed580d --- /dev/null +++ b/test/PowerShell.Tests/Commands/PartnerTests.cs @@ -0,0 +1,204 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using System.Management.Automation; + using Authentication; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.CountryValidationRules; + using PartnerCenter.Models.Partners; + using PartnerCenter.PowerShell.Tests.Factories; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available partner cmdlets. + /// + [TestClass] + public class PartnerTests : TestBase + { + /// + /// Unit test for the Get-PartnerBillingProfile cmdlet. + /// + [TestMethod] + public void GetBillingProfileTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerBillingProfile"); + } + + /// + /// Unit test for the Get-PartnerLegalProfile cmdlet. + /// + [TestMethod] + public void GetPartnerLegalProfileTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerLegalProfile"); + } + + /// + /// Unit test for the Get-PartnerSupportProfile cmdlet. + /// + [TestMethod] + public void GetPartnerSupportProfileTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerSupportProfile"); + } + + /// + /// Unit test for the Set-PartnerBillingProfile cmdlet. + /// + [TestMethod] + public void SetBillingProfileTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-SetPartnerBillingProfile"); + } + + /// + /// Unit test for the Set-PartnerBillingPorifle cmdlet that expects the exception to be thrown. + /// + [ExpectedException(typeof(CmdletInvocationException))] + [TestMethod] + public void SetBillingProfileWithInvalidAddressTest() + { + RunPowerShellTest(CreatePartnerOperationsWithInvalidAddress, "Test-SetPartnerBillingProfile"); + } + + /// + /// Unit test for the Set-SetPartnerLegalProfile cmdlet. + /// + [TestMethod] + public void SetPartnerLegalProfileTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-SetPartnerLegalProfile"); + } + + /// + /// Unit test for the Set-SetPartnerSupportProfile cmdlet. + /// + [TestMethod] + public void SetPartnerSupportProfileTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-SetPartnerSupportProfile"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + public IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + // Billing Profile + partnerOperations.Setup(p => p.Profiles.BillingProfile.Get()).Returns(GetPartnerBillingProfile()); + partnerOperations.Setup(p => p.Profiles.BillingProfile.Update(It.IsAny())).Returns(GetPartnerBillingProfileUpdated()); + + // Country Validation Rules + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry(It.IsAny()).Get()).Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-US")); + + // Legal Profile + partnerOperations.Setup(p => p.Profiles.LegalBusinessProfile.Get(VettingVersion.Current)).Returns( + OperationFactory.Instance.GetResource("GetPartnerLegalProfile")); + partnerOperations.Setup(p => p.Profiles.LegalBusinessProfile.Update(It.IsAny())).Returns( + OperationFactory.Instance.GetResource("UpdatePartnerLegalProfile")); + + // Support Profile + partnerOperations.Setup(p => p.Profiles.SupportProfile.Get()).Returns( + OperationFactory.Instance.GetResource("GetPartnerSupportProfile")); + partnerOperations.Setup(p => p.Profiles.SupportProfile.Get()).Returns( + OperationFactory.Instance.GetResource("UpdatePartnerSupportProfile")); + + // Validations + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry(It.IsAny()).Get()).Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-US")); + return partnerOperations.Object; + } + + /// + /// Creates an instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private IPartner CreatePartnerOperationsWithInvalidAddress(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.Profiles.BillingProfile.Get()).Returns(GetPartnerBillingProfile()); + partnerOperations.Setup(p => p.Profiles.BillingProfile.Update(It.IsAny())).Returns(GetPartnerBillingProfileUpdated()); + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(false); + + return partnerOperations.Object; + } + + /// + /// Gets an instance of the class used for testing purposees. + /// + /// + /// An instance of the class used for testing purposes. + /// + private BillingProfile GetPartnerBillingProfile() + { + return new BillingProfile + { + Address = new Address + { + AddressLine1 = "1 Microsoft Way", + City = "Redmond", + Country = "US", + PostalCode = "98052", + State = "WA" + }, + BillingCurrency = "USD", + BillingDay = 1, + CompanyName = "Contoso", + PrimaryContact = new Contact + { + Email = "john@contoso.com", + FirstName = "John", + LastName = "Doe", + PhoneNumber = "555-555-5555" + }, + PurchaseOrderNumber = "1234", + TaxId = "5678" + }; + } + + /// + /// Gets an instance of the class used for unit testing. + /// + /// + /// An instance of the class used for testing purposes. + /// + private BillingProfile GetPartnerBillingProfileUpdated() + { + return new BillingProfile + { + Address = new Address + { + AddressLine1 = "700 Bellevue Way NE", + City = "Bellevue", + Country = "US", + PostalCode = "98004", + State = "WA" + }, + BillingCurrency = "USD", + BillingDay = 1, + CompanyName = "Contoso", + PrimaryContact = new Contact + { + Email = "jdoe@contoso.com", + FirstName = "Jonathan", + LastName = "Doe", + PhoneNumber = "425-555-5555" + }, + PurchaseOrderNumber = "1234", + TaxId = "0123" + }; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/PartnerTests.ps1 b/test/PowerShell.Tests/Commands/PartnerTests.ps1 new file mode 100644 index 0000000..e8751fa --- /dev/null +++ b/test/PowerShell.Tests/Commands/PartnerTests.ps1 @@ -0,0 +1,67 @@ +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerBillingProfile cmdlet. +#> +function Test-GetPartnerBillingProfile +{ + $profile = Get-PartnerBillingProfile + + Assert-NotNullOrEmpty $profile.CompanyName 'Company name should not be null' + Assert-NotNullOrEmpty $profile.PrimaryContact.FirstName 'The first name of the primary contact should not be null' + Assert-NotNullOrEmpty $profile.PrimaryContact.LastName 'The last name of the primary contact should not be null' +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerLegalProfile cmdlet. +#> +function Test-GetPartnerLegalProfile +{ + $profile = Get-PartnerLegalProfile + + Assert-NotNull $profile.Address + Assert-NotNull $profile.CompanyApproverAddress + Assert-NotNull $profile.PrimaryContact + + Assert-NotNullOrEmpty $profile.CompanyName + Assert-NotNullOrEmpty $profile.CompanyApproverEmail +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerSupportProfile cmdlet. +#> +function Test-GetPartnerSupportProfile +{ + $profile = Get-PartnerSupportProfile + + Assert-NotNullOrEmpty $profile.Email + Assert-NotNullOrEmpty $profile.Website +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerBillingProfile cmdlet. +#> +function Test-SetPartnerBillingProfile +{ + Set-PartnerBillingProfile -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -EmailAddress 'jdoe@contoso.com' -FirstName 'Jonathan' -LastName 'Doe' -PhoneNumber '425-555-5555' -PostalCode '98004' -PurchaseOrderNumber '1234' -State 'WA' -TaxId '0123' +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerLegalProfile cmdlet. +#> +function Test-SetPartnerLegalProfile +{ + Set-PartnerLegalProfile -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -EmailAddress 'jdoe@lucernepublishing.com' -FirstName 'Jonathan' -LastName 'Doe' -PhoneNumber '425-555-5555' -PostalCode '98004' -State 'WA' +} + +<# +.SYNOPSIS +Tests to be performed using the Set-PartnerSupportProfile cmdlet. +#> +function Test-SetPartnerSupportProfile +{ + Set-PartnerSupportProfile -SupportEmail 'support@contoso.com' -SupportPhoneNumber '4255555555' -SupportWebsite 'https://www.microsoft.com' +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/ProductTests.cs b/test/PowerShell.Tests/Commands/ProductTests.cs new file mode 100644 index 0000000..43fe950 --- /dev/null +++ b/test/PowerShell.Tests/Commands/ProductTests.cs @@ -0,0 +1,96 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using System.Collections.Generic; + using Authentication; + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.Products; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available partner cmdlets. + /// + [TestClass] + public class ProductTests : TestBase + { + /// + /// Unit test for the Get-PartnerProduct cmdlet. + /// + [TestMethod] + public void GetPartnerProductTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerProduct"); + } + + /// + /// Unit test for the Get-PartnerProductAvailability cmdlet. + /// + [TestMethod] + public void GetPartnerProductAvailabilityTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerProductAvailability"); + } + + /// + /// Unit test for the Get-PartnerProductInventory cmdlet. + /// + [TestMethod] + public void GetPartnerProductInventoryTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerProductInventory"); + } + + /// + /// Unit test for the Get-PartnerProductSku cmdlet. + /// + [TestMethod] + public void GetPartnerProductSkuTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerProductSku"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + // Product + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ByTargetView(It.IsAny()).Get()) + .Returns(OperationFactory.Instance.GetResource>("GetProduct")); + + // Product Availability + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ById(It.IsAny()).Skus.ById(It.IsAny()).Availabilities.ByTargetSegment(It.IsAny()).Get()) + .Returns(OperationFactory.Instance.GetResource>("GetProductAvailability")); + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ById(It.IsAny()).Skus.ById(It.IsAny()).Availabilities.Get()) + .Returns(OperationFactory.Instance.GetResource>("GetProductAvailability")); + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ById(It.IsAny()).Skus.ById(It.IsAny()).Availabilities.ById(It.IsAny()).Get()) + .Returns(OperationFactory.Instance.GetResource("GetProductAvailabilityById")); + + // Product Inventory + partnerOperations.Setup(p => p.Extensions.Product.ByCountry(It.IsAny()).CheckInventory(It.IsAny())).Returns( + OperationFactory.Instance.GetResource>("GetProductInventory")); + + // Product SKUs + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ById(It.IsAny()).Skus.ById(It.IsAny()).Get()) + .Returns(OperationFactory.Instance.GetResource("GetProductSku")); + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ById(It.IsAny()).Skus.Get()) + .Returns(OperationFactory.Instance.GetResource>("GetProductSku")); + partnerOperations.Setup(p => p.Products.ByCountry(It.IsAny()).ById(It.IsAny()).Skus.ByTargetSegment(It.IsAny()).Get()) + .Returns(OperationFactory.Instance.GetResource>("GetProductSku")); + + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/ProductTests.ps1 b/test/PowerShell.Tests/Commands/ProductTests.ps1 new file mode 100644 index 0000000..8cd5170 --- /dev/null +++ b/test/PowerShell.Tests/Commands/ProductTests.ps1 @@ -0,0 +1,98 @@ +$TestProductId = "DZH318Z0BQ4C" +$TestSkuId = "00FF" +$TestAvailabilityId = "DZH318Z0RFQB" + + +# Catalogs can be "Azure", "OnlineServices", "Software" +$TestCatalog = "Azure" + +$TestCountryCode = "US" + +# Segments can be: "commercial", "education", "government", "nonprofit" +$TestTargetSegment = "commercial" + + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerProduct cmdlet. +#> +function Test-GetPartnerProduct +{ + $product = Get-PartnerProduct -Catalog $TestCatalog + + Assert-NotNullOrEmpty $product[0].productId 'ProductId should not be null' + Assert-NotNullOrEmpty $product[0].Title 'Title should not be null' + Assert-NotNullOrEmpty $product[0].Type 'Type should not be null' + Assert-NotNullOrEmpty $product[0].ProductType.Id 'ProductType.Id should not be null' + Assert-NotNullOrEmpty $product[0].ProductType.DisplayName 'ProductType.DisplayName should not be null' + + if ($null -eq $product[0].Description) + { + Assert-NotNullOrEmpty $product[1].Description 'Description should not be null' + } +} + + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerProductAvailability cmdlet. +#> +function Test-GetPartnerProductAvailability +{ + # Testing by Sku without target segment + $ProductAvailability = Get-PartnerProductAvailability -ProductId $TestProductId -SkuId $TestSkuId -CountryCode $TestCountryCode + + Assert-NotNullOrEmpty $ProductAvailability.SkuId "SkuId should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrency.Code "DefaultCurrency.Code should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrency.Symbol "DefaultCurrency.Symbol should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrencyCode "DefaultCurrencyCode should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrencySymbol "DefaultCurrencySymbol should not be null" + + # Testing by Sku with target segment + $ProductAvailability = Get-PartnerProductAvailability -ProductId $TestProductId -SkuId $TestSkuId -CountryCode $TestCountryCode -segment $TestTargetSegment + + Assert-NotNullOrEmpty $ProductAvailability.SkuId "SkuId should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrency.Code "DefaultCurrency.Code should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrency.Symbol "DefaultCurrency.Symbol should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrencyCode "DefaultCurrencyCode should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrencySymbol "DefaultCurrencySymbol should not be null" + + # Testing by AvailabilityId + $ProductAvailability = Get-PartnerProductAvailability -ProductId $TestProductId -SkuId $TestSkuId -AvailabilityId $TestAvailabilityId -CountryCode $TestCountryCode + + Assert-NotNullOrEmpty $ProductAvailability.SkuId "SkuId should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrencyCode "DefaultCurrencyCode should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrencySymbol "DefaultCurrencySymbol should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrency.Code "DefaultCurrency.Code should not be null" + Assert-NotNullOrEmpty $ProductAvailability.DefaultCurrency.Symbol "DefaultCurrency.Symbol should not be null" +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerProductInventory cmdlet. +#> +function Test-GetPartnerProductInventory +{ + $variables = @{ customerId='46a62ece-10ad-42e5-b3f1-b2ed53e6fc08'; azureSubscriptionId='a38ad5c9-5198-4e80-8064-2599ba6b8833'; armRegionName='uswest2' } + + Get-PartnerProductInventory -ProductId 'DZH318Z0BQ3P' -Variables $variables +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerProductSku cmdlet. +#> +function Test-GetPartnerProductSku +{ + # Testing without specifying segment + $ProductSku = Get-PartnerProductSku -ProductId $TestProductId -CountryCode $TestCountryCode + Assert-NotNullOrEmpty $ProductSku[0].SkuId "SkuId should not be null" + Assert-NotNullOrEmpty $ProductSku[0].ProductId "ProductId should not be null" + Assert-NotNullOrEmpty $ProductSku[0].Title "Title should not be null" + + # Testing specifying segment + $ProductSku = Get-PartnerProductSku -ProductId $TestProductId -CountryCode $TestCountryCode -Segment $TestTargetSegment + Assert-NotNullOrEmpty $ProductSku[0].SkuId "SkuId should not be null" + Assert-NotNullOrEmpty $ProductSku[0].ProductId "ProductId should not be null" + Assert-NotNullOrEmpty $ProductSku[0].Title "Title should not be null" +} diff --git a/test/PowerShell.Tests/Commands/RateCardTests.cs b/test/PowerShell.Tests/Commands/RateCardTests.cs new file mode 100644 index 0000000..e26cad3 --- /dev/null +++ b/test/PowerShell.Tests/Commands/RateCardTests.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using Authentication; + using Factories; + using Moq; + using PartnerCenter.Models.RateCards; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available audit record cmdlets. + /// + [TestClass] + public class RateCardTests : TestBase + { + /// + /// Unit test for the Get-PartnerAzureRateCard cmdlet. + /// + [TestMethod] + public void GetPartnerAzureRateCardTests() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerAzureRateCard"); + } + + /// + /// Unit test for the Get-PartnerAzureRateCard cmdlet. + /// + [TestMethod] + public void GetPartnerAzureRateCardSharedServiceTest() + { + RunPowerShellTest(CreatePartnerOperations, "Test-GetPartnerAzureRateCardSharedServices"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + partnerOperations.Setup(p => p.RateCards.Azure.Get(null, null)).Returns( + OperationFactory.Instance.GetResource("GetAzureRateCard")); + + partnerOperations.Setup(p => p.RateCards.Azure.GetShared(null, null)).Returns( + OperationFactory.Instance.GetResource("GetAzureRateCardSharedServices")); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/RateCardTests.ps1 b/test/PowerShell.Tests/Commands/RateCardTests.ps1 new file mode 100644 index 0000000..c974289 --- /dev/null +++ b/test/PowerShell.Tests/Commands/RateCardTests.ps1 @@ -0,0 +1,27 @@ +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerAzureRateCard cmdlet. +#> +function Test-GetPartnerAzureRateCard +{ + $rateCard = Get-PartnerAzureRateCard + + Assert-NotNull $rateCard + Assert-NotNull $rateCard.Meters + + Assert-NotNullOrEmpty $rateCard.Meters[0].Name +} + +<# +.SYNOPSIS +Tests to be performed using the Get-PartnerAzureRateCard cmdlet. +#> +function Test-GetPartnerAzureRateCardSharedServices +{ + $rateCard = Get-PartnerAzureRateCard -SharedServices + + Assert-NotNull $rateCard + Assert-NotNull $rateCard.Meters + + Assert-NotNullOrEmpty $rateCard.Meters[0].Name +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/ValidationTests.cs b/test/PowerShell.Tests/Commands/ValidationTests.cs new file mode 100644 index 0000000..363ea47 --- /dev/null +++ b/test/PowerShell.Tests/Commands/ValidationTests.cs @@ -0,0 +1,50 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Commands +{ + using Authentication; + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.CountryValidationRules; + using VisualStudio.TestTools.UnitTesting; + + /// + /// Unit tests for the available validation cmdlets. + /// + [TestClass] + public class ValidationTests : TestBase + { + /// + /// Unit test for the Test-PartnerAddress cmdlet. + /// + [TestMethod] + public void TestPartnerAddressTests() + { + RunPowerShellTest(CreatePartnerOperations, "Test-TestPartnerAddress"); + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + private static IPartner CreatePartnerOperations(PartnerContext context) + { + Mock partnerOperations = new Mock(); + + // Country Valiation Operations + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("US").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-US")); + + // Validations + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + + return partnerOperations.Object; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Commands/ValidationTests.ps1 b/test/PowerShell.Tests/Commands/ValidationTests.ps1 new file mode 100644 index 0000000..ad1d494 --- /dev/null +++ b/test/PowerShell.Tests/Commands/ValidationTests.ps1 @@ -0,0 +1,10 @@ +<# +.SYNOPSIS +Tests to be performed using the Test-PartnerAddress cmdlet. +#> +function Test-TestPartnerAddress +{ + $isValid = Test-PartnerAddress -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -Country 'US' -PostalCode '98004' -State 'WA' + + Assert-AreEqual $isValid $true +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Converters/CustomerConverTests.cs b/test/PowerShell.Tests/Converters/CustomerConverTests.cs new file mode 100644 index 0000000..9c820c6 --- /dev/null +++ b/test/PowerShell.Tests/Converters/CustomerConverTests.cs @@ -0,0 +1,72 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Converters +{ + using Converts; + using PartnerCenter.Models; + using PartnerCenter.Models.Customers; + using PowerShell.Commands; + using VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class CustomerConverTests + { + [TestMethod] + public void ConvertTest() + { + Customer customer; + SetPartnerCustomer cmdlet; + + try + { + cmdlet = new SetPartnerCustomer + { + BillingAddressLine1 = "12012 Sunset Hills Road", + BillingAddressLine2 = "Suite 100", + BillingAddressCity = "Reston", + BillingAddressCountry = "US", + BillingAddressPostalCode = "20190", + BillingAddressRegion = "Test-Value", + BillingAddressState = "VA", + Name = "Microsoft MTC" + }; + + customer = new Customer + { + BillingProfile = new CustomerBillingProfile + { + DefaultAddress = new Address + { + AddressLine1 = "1 Microsoft Way", + AddressLine2 = "Second Line", + City = "Redmond", + Country = "US", + PostalCode = "98052", + State = "WA" + } + } + }; + + new CustomerConverter(cmdlet, customer).Convert(); + + Assert.AreEqual("12012 Sunset Hills Road", customer.BillingProfile.DefaultAddress.AddressLine1); + Assert.AreEqual("Suite 100", customer.BillingProfile.DefaultAddress.AddressLine2); + Assert.AreEqual("Reston", customer.BillingProfile.DefaultAddress.City); + Assert.AreEqual("US", customer.BillingProfile.DefaultAddress.Country); + Assert.AreEqual("20190", customer.BillingProfile.DefaultAddress.PostalCode); + Assert.AreEqual("Test-Value", customer.BillingProfile.DefaultAddress.Region); + Assert.AreEqual("VA", customer.BillingProfile.DefaultAddress.State); + Assert.AreEqual("Microsoft MTC", customer.BillingProfile.CompanyName); + } + finally + { + cmdlet = null; + customer = null; + } + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Enumerators/ResourceCollectionEnumerator.cs b/test/PowerShell.Tests/Enumerators/ResourceCollectionEnumerator.cs new file mode 100644 index 0000000..80d08b1 --- /dev/null +++ b/test/PowerShell.Tests/Enumerators/ResourceCollectionEnumerator.cs @@ -0,0 +1,108 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Enumerators +{ + using System.Threading.Tasks; + using Common; + using PartnerCenter.Enumerators; + using PartnerCenter.Models; + using RequestContext; + + /// + /// Provides resource collection enumeration capabilities. + /// + /// The enumeration result type. + public sealed class ResourceCollectionEnumerator : IResourceCollectionEnumerator where T : ResourceBaseWithLinks + { + /// + /// The current resource collection. + /// + private T resourceCollection; + + /// + /// Initializes a new instance of the class. + /// + /// The initial resource collection. + /// + /// is null. + /// + public ResourceCollectionEnumerator(T resourceCollection) + { + resourceCollection.AssertNotNull(nameof(resourceCollection)); + + this.resourceCollection = resourceCollection; + } + + /// + /// Gets the current resource collection. + /// + public T Current => resourceCollection; + + /// + /// Gets whether the current result collection has a value or not. This indicates if the collection has been fully enumerated or not. + /// + public bool HasValue => resourceCollection != null; + + /// + /// Gets whether the current result collection is the first page of results or not. + /// + public bool IsFirstPage => true; + + /// + /// Gets whether the current result collection is the first page of results or not. + /// + public bool IsLastPage => true; + + /// + /// Retrieves the next result set. + /// + /// + /// An optional request context. If not provided, the context associated with the partner operations will be used. + /// + public void Next(IRequestContext context = null) + { + resourceCollection = default(T); + } + + /// + /// Retrieves the next result set. + /// + /// + /// An optional request context. If not provided, the context associated with the partner operations will be used. + /// + public async Task NextAsync(IRequestContext context = null) + { + resourceCollection = default(T); + + await Task.CompletedTask; + } + + /// + /// Retrieves the previous result set. + /// + /// + /// An optional request context. If not provided, the context associated with the partner operations will be used. + /// + public void Previous(IRequestContext context = null) + { + resourceCollection = default(T); + } + + /// + /// Retrieves the previous result set. + /// + /// + /// An optional request context. If not provided, the context associated with the partner operations will be used. + /// + public async Task PreviousAsync(IRequestContext context = null) + { + resourceCollection = default(T); + + await Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Factories/MockAuthenticationFactory.cs b/test/PowerShell.Tests/Factories/MockAuthenticationFactory.cs new file mode 100644 index 0000000..49bbe4d --- /dev/null +++ b/test/PowerShell.Tests/Factories/MockAuthenticationFactory.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Factories +{ + using System; + using System.Security; + using Authentication; + using Common; + using IdentityModel.Clients.ActiveDirectory; + using PowerShell.Factories; + + /// + /// Factory that mocks authenticaton operations. + /// + public class MockAuthenticationFactory : IAuthenticationFactory + { + public PartnerContext Authenticate(string applicationId, EnvironmentName environment, string username, SecureString password, string tenantId) + { + throw new NotImplementedException(); + } + + /// + /// Authenticates the user using the specified parameters. + /// + /// The partner's execution context. + /// The password used to authenicate the user. This value can be null. + /// The result from the authentication request. + /// + /// is null. + /// + public AuthenticationResult Authenticate(PartnerContext context, SecureString password) + { + context.AssertNotNull(nameof(context)); + + throw new NotImplementedException(); + } + } +} diff --git a/test/PowerShell.Tests/Factories/MockClientFactory.cs b/test/PowerShell.Tests/Factories/MockClientFactory.cs new file mode 100644 index 0000000..17af5f8 --- /dev/null +++ b/test/PowerShell.Tests/Factories/MockClientFactory.cs @@ -0,0 +1,41 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Factories +{ + using System; + using Authentication; + using PowerShell.Factories; + + /// + /// Factory that provides initialized clients used to mock interactions with online services. + /// + public class MockClientFactory : IClientFactory + { + /// + /// Delegate used to initialize the partner operations. + /// + private readonly Func initializeFunc; + + /// + /// Initializes a new instance of the class. + /// + public MockClientFactory(Func initializeFunc) + { + this.initializeFunc = initializeFunc; + } + + /// + /// Creates a new instance of the object used to interface with Partner Center. + /// + /// The partner's execution context. + /// An instance of the class. + public IPartner CreatePartnerOperations(PartnerContext context) + { + return initializeFunc(context); + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Factories/OperationFactory.cs b/test/PowerShell.Tests/Factories/OperationFactory.cs new file mode 100644 index 0000000..5975694 --- /dev/null +++ b/test/PowerShell.Tests/Factories/OperationFactory.cs @@ -0,0 +1,180 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Factories +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Reflection; + using System.Runtime.CompilerServices; + using Newtonsoft.Json; + using PartnerCenter.Models; + using PartnerCenter.Models.Customers; + + public class OperationFactory + { + /// + /// Singleton instance of the class. + /// + private static readonly Lazy instance = new Lazy(); + + /// + /// Gets an instance of the class. + /// + public static OperationFactory Instance => instance.Value; + + /// + /// Gets the specified resource by desearilizing the recorded session. + /// + /// Type of resource to be returned. + /// Identity of the test being performed. + /// An object that represents the requeested object. + public T GetResource([CallerMemberName]string identity = "") => JsonConvert.DeserializeObject( + File.ReadAllText( + Path.Combine( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + "SessionRecords", + $"{identity}.json"))); + + /// + /// Gets a customer for unit testing. + /// + /// A customer for unit testing. + public Customer GetCustomer() => new Customer + { + BillingProfile = new CustomerBillingProfile + { + DefaultAddress = new Address + { + AddressLine1 = "1 Microsoft Way", + City = "Redmond", + Country = "US", + PostalCode = "98052", + State = "WA" + } + }, + CompanyProfile = new CustomerCompanyProfile + { + CompanyName = "Contoso", + Domain = "contoso.onmicrosoft.com" + }, + Id = "46a62ece-10ad-42e5-b3f1-b2ed53e6fc08" + }; + + /// + /// Gets a customer billing profile for unit testing. + /// + /// A customer billing profile for unit testing. + public CustomerBillingProfile GetCustomerBillingProfile() => new CustomerBillingProfile + { + CompanyName = "Contoso", + Culture = "en-US", + DefaultAddress = new Address + { + AddressLine1 = "700 Bellevue Way NE", + City = "Redmond", + Country = "US", + PostalCode = "98004", + State = "WA" + }, + Email = "jdoe@contoso.com", + FirstName = "John", + Language = "en", + LastName = "Doe" + }; + + /// + /// Gets a list of customers for unit testing. + /// + /// A resource collection of customer used for unit testing. + public SeekBasedResourceCollection GetCustomers() => new SeekBasedResourceCollection(new List + { + { + new Customer + { + BillingProfile = new CustomerBillingProfile + { + DefaultAddress = new Address + { + AddressLine1 = "1 Microsoft Way", + City = "Redmond", + Country = "US", + PostalCode = "98052", + State = "WA" + } + }, + CompanyProfile = new CustomerCompanyProfile + { + CompanyName = "Contoso", + Domain = "contoso.onmicrosoft.com" + }, + Id = "46a62ece-10ad-42e5-b3f1-b2ed53e6fc08" + } + }, + { + new Customer + { + BillingProfile = new CustomerBillingProfile + { + DefaultAddress = new Address + { + AddressLine1 = "700 Bellevue Way NE", + City = "Redmond", + Country = "US", + PostalCode = "98004", + State = "WA" + } + }, + CompanyProfile = new CustomerCompanyProfile + { + CompanyName = "TailSpin Toys", + Domain = "tailspintoys.onmicrosoft.com" + }, + Id = "f28ec9a4-fbb6-43e2-a634-c4e0bbb44842" + } + } + }); + + /// + /// Gets a customer for unit testing the creation of a customer. + /// + /// A customer for unit testing. + public Customer GetNewCustomer() => new Customer + { + BillingProfile = new CustomerBillingProfile + { + CompanyName = "Tailspin Toys", + Culture = "en-US", + DefaultAddress = new Address + { + AddressLine1 = "12012 Sunset Hills Rd", + City = "Reston", + Country = "US", + PostalCode = "20190", + State = "VA" + }, + Email = "hugh@tailspintoys.com", + FirstName = "Hugh", + LastName = "Williams", + Language = "en" + }, + CompanyProfile = new CustomerCompanyProfile + { + CompanyName = "TailSpin Toys", + Domain = "tailspintoys.onmicrosoft.com", + TenantId = "f28ec9a4-fbb6-43e2-a634-c4e0bbb44842" + }, + Id = "f28ec9a4-fbb6-43e2-a634-c4e0bbb44842", + RelationshipToPartner = CustomerPartnerRelationship.None, + UserCredentials = new UserCredentials + { + Password = "=;;n.=s9Z", + UserName = "admin" + } + }; + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/PowerShell.Tests.csproj b/test/PowerShell.Tests/PowerShell.Tests.csproj new file mode 100644 index 0000000..044b244 --- /dev/null +++ b/test/PowerShell.Tests/PowerShell.Tests.csproj @@ -0,0 +1,289 @@ + + + + + Debug + AnyCPU + {3407AFBC-72DA-491C-816F-2176D2E06DB4} + Library + Properties + Microsoft.Store.PartnerCenter.PowerShell.Tests + Microsoft.Store.PartnerCenter.PowerShell.Tests + v4.6.1 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll + + + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.29.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + ..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.29.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + + ..\..\packages\Microsoft.Store.PartnerCenter.1.9.0\lib\Net45\Microsoft.Store.PartnerCenter.dll + + + ..\..\packages\Microsoft.Store.PartnerCenter.1.9.0\lib\Net45\Microsoft.Store.PartnerCenter.Extensions.dll + + + ..\..\packages\Microsoft.Store.PartnerCenter.1.9.0\lib\Net45\Microsoft.Store.PartnerCenter.Models.dll + + + ..\..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + ..\..\packages\Moq.4.9.0\lib\net45\Moq.dll + + + ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll + + + + + + ..\..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll + + + ..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + + ..\..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll + + + ..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + Always + + + Always + + + Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + {6714ca29-04a6-4d4e-919c-28af294e6ba6} + PowerShell + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/test/PowerShell.Tests/PowerShellExtensions.cs b/test/PowerShell.Tests/PowerShellExtensions.cs new file mode 100644 index 0000000..992cfae --- /dev/null +++ b/test/PowerShell.Tests/PowerShellExtensions.cs @@ -0,0 +1,24 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests +{ + using System.Management.Automation; + + /// + /// Useful extensions for unit testing the PowerShell cmdlets. + /// + internal static class PowerShellExtensions + { + /// + /// Formats an to a detailed string for logging. + /// + internal static string FormatErrorRecord(ErrorRecord record) + { + return $"PowerShell Error Record: {record}\nException:{record.Exception}\nDetails:{record.ErrorDetails}\nScript Stack Trace: {record.ScriptStackTrace}\n: Target: {record.TargetObject}\n"; + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Properties/AssemblyInfo.cs b/test/PowerShell.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2f1eba0 --- /dev/null +++ b/test/PowerShell.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("PowerShell.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PowerShell.Tests")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("3407afbc-72da-491c-816f-2176d2e06db4")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/PowerShell.Tests/SessionRecords/AddCustomerUserRoleMember.json b/test/PowerShell.Tests/SessionRecords/AddCustomerUserRoleMember.json new file mode 100644 index 0000000..8f36476 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/AddCustomerUserRoleMember.json @@ -0,0 +1,9 @@ +{ + "displayName": "Daniel Tsai", + "userPrincipalName": "Daniel@dtdemocspcustomer005.onmicrosoft.com", + "roleId": "f023fd81-a637-4b56-95fd-791ac0226033", + "id": "a9ef48bb-8758-4590-a312-d4a47bfaded4", + "attributes": { + "objectType": "UserMember" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetAuditRecord.json b/test/PowerShell.Tests/SessionRecords/GetAuditRecord.json new file mode 100644 index 0000000..9ea0681 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetAuditRecord.json @@ -0,0 +1,160 @@ +{ + "totalCount": 2, + "items": [ + { + "id": "ba358974-f825-4d5e-9d60-a62125c766c7_636679632433466529", + "partnerId": "ba358974-f825-4d5e-9d60-a62125c766c7", + "customerId": "c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2", + "customerName": "Contoso", + "userPrincipalName": "jdoe@csppartner.onmicrosoft.com", + "applicationId": "11a3c51f-842a-4333-a844-2bd9deca2b51", + "sessionId": "294e3c23-7f96-44fe-b016-9b9d8d252ddd", + "resourceType": "order", + "resourceNewValue": "{\"Id\":\"6cd23b3f-453c-4d55-881e-eeadf793b9ab\",\"ReferenceCustomerId\":\"c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2\",\"BillingCycle\":\"monthly\",\"CurrencyCode\":\"USD\",\"LineItems\":[{\"LineItemNumber\":0,\"OfferId\":\"796B6B5F-613C-4E24-A17C-EBA730D49C02\",\"SubscriptionId\":\"85AD7186-42E3-42A0-BA53-10EF49115C7B\",\"ParentSubscriptionId\":null,\"ProvisioningContext\":null,\"FriendlyName\":\"Office 365 Enterprise E3\",\"Quantity\":1,\"PartnerIdOnRecord\":null,\"Links\":{\"Subscription\":{\"Uri\":\"/customers/c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2/subscriptions/85AD7186-42E3-42A0-BA53-10EF49115C7B\",\"Method\":\"GET\",\"Headers\":[]},\"Sku\":{\"Uri\":\"/products/6FD2C87F-B296-42F0-B197-1E91E994B900/skus/796B6B5F-613C-4E24-A17C-EBA730D49C02\",\"Method\":\"GET\",\"Headers\":[]},\"ProvisioningStatus\":{\"Uri\":\"/subscriptions/85AD7186-42E3-42A0-BA53-10EF49115C7B/provisioningstatus\",\"Method\":\"GET\",\"Headers\":[]}}}],\"CreationDate\":\"2018-07-23T10:20:42.81-07:00\",\"Status\":\"completed\",\"Links\":{\"Self\":{\"Uri\":\"/customers/c4f6bf3c-60de-432e-a3ec-20bcc5b26ec2/orders/6cd23b3f-453c-4d55-881e-eeadf793b9ab\",\"Method\":\"GET\",\"Headers\":[]}},\"Attributes\":{\"Etag\":\"eyJpZCI6ImJkNDhkZDAwLTZlYWEtNDA0Ny1iNWI5LTZmNTUyMjM4OTEwNSIsInZlcnNpb24iOjF9\",\"ObjectType\":\"Order\"}}", + "operationType": "create_order", + "originalCorrelationId": "d432eec8-6795-41fb-e698-faa64dc80ed5", + "operationDate": "2018-07-23T17:20:43.3466529Z", + "operationStatus": "succeeded", + "customizedData": [ + { + "key": "OrderId", + "value": "6cd23b3f-453c-4d55-881e-eeadf793b9ab" + }, + { + "key": "BillingCycle", + "value": "Monthly" + }, + { + "key": "OfferId-0", + "value": "796B6B5F-613C-4E24-A17C-EBA730D49C02" + }, + { + "key": "SubscriptionId-0", + "value": "85AD7186-42E3-42A0-BA53-10EF49115C7B" + }, + { + "key": "SubscriptionName-0", + "value": "Office 365 Enterprise E3" + }, + { + "key": "Quantity-0", + "value": "1" + }, + { + "key": "PartnerOnRecord-0", + "value": null + } + ], + "attributes": { + "objectType": "AuditRecord" + } + }, + { + "id": "ba358974-f825-4d5e-9d60-a62125c766c7_636679689244587837", + "partnerId": "ba358974-f825-4d5e-9d60-a62125c766c7", + "customerId": "46a62ece-10ad-42e5-b3f1-b2ed53e6fc08", + "customerName": "Contoso", + "userPrincipalName": "jdoe@csppartner.onmicrosoft.com", + "applicationId": "11a3c51f-842a-4333-a844-2bd9deca2b51", + "sessionId": "df870750-5f95-42b9-fe6d-b8138710cdcb", + "resourceType": "order", + "resourceNewValue": "{\"Id\":\"4c338a31-677e-42cd-b7ca-8a19e0375790\",\"ReferenceCustomerId\":\"c7aa13ad-e62f-463d-a706-845ce80c14b3\",\"BillingCycle\":\"monthly\",\"CurrencyCode\":\"USD\",\"LineItems\":[{\"LineItemNumber\":0,\"OfferId\":\"796B6B5F-613C-4E24-A17C-EBA730D49C02\",\"SubscriptionId\":\"FB28975C-AB81-4EDB-BC78-A7ED5043A7D2\",\"ParentSubscriptionId\":null,\"ProvisioningContext\":null,\"FriendlyName\":\"Office 365 Enterprise E3\",\"Quantity\":2,\"PartnerIdOnRecord\":null,\"Links\":{\"Subscription\":{\"Uri\":\"/customers/c7aa13ad-e62f-463d-a706-845ce80c14b3/subscriptions/FB28975C-AB81-4EDB-BC78-A7ED5043A7D2\",\"Method\":\"GET\",\"Headers\":[]},\"Sku\":{\"Uri\":\"/products/6FD2C87F-B296-42F0-B197-1E91E994B900/skus/796B6B5F-613C-4E24-A17C-EBA730D49C02\",\"Method\":\"GET\",\"Headers\":[]},\"ProvisioningStatus\":{\"Uri\":\"/subscriptions/FB28975C-AB81-4EDB-BC78-A7ED5043A7D2/provisioningstatus\",\"Method\":\"GET\",\"Headers\":[]}}}],\"CreationDate\":\"2018-07-23T11:55:24.307-07:00\",\"Status\":\"completed\",\"Links\":{\"Self\":{\"Uri\":\"/customers/c7aa13ad-e62f-463d-a706-845ce80c14b3/orders/4c338a31-677e-42cd-b7ca-8a19e0375790\",\"Method\":\"GET\",\"Headers\":[]}},\"Attributes\":{\"Etag\":\"removed\",\"ObjectType\":\"Order\"}}", + "operationType": "create_order", + "originalCorrelationId": "077f2d04-f6d4-4c70-d800-ff07774a641e", + "operationDate": "2018-07-23T18:55:24.4587837Z", + "operationStatus": "succeeded", + "customizedData": [ + { + "key": "OrderId", + "value": "4c338a31-677e-42cd-b7ca-8a19e0375790" + }, + { + "key": "BillingCycle", + "value": "Monthly" + }, + { + "key": "OfferId-0", + "value": "796B6B5F-613C-4E24-A17C-EBA730D49C02" + }, + { + "key": "SubscriptionId-0", + "value": "FB28975C-AB81-4EDB-BC78-A7ED5043A7D2" + }, + { + "key": "SubscriptionName-0", + "value": "Office 365 Enterprise E3" + }, + { + "key": "Quantity-0", + "value": "2" + }, + { + "key": "PartnerOnRecord-0", + "value": null + } + ], + "attributes": { + "objectType": "AuditRecord" + } + }, + { + "id": "ba358974-f825-4d5e-9d60-a62125c766c7_636679692860039212", + "partnerId": "ba358974-f825-4d5e-9d60-a62125c766c7", + "customerId": "46a62ece-10ad-42e5-b3f1-b2ed53e6fc08", + "customerName": "Contoso", + "userPrincipalName": "jdoe@csppartner.onmicrosoft.com", + "applicationId": "11a3c51f-842a-4333-a844-2bd9deca2b51", + "sessionId": "b6124cc1-6b1c-4f04-f2e2-29e768bf6863", + "resourceType": "subscription", + "resourceOldValue": "{\"Id\":\"58968085-83C6-49C1-B91A-7CFA117DF168\",\"OfferId\":\"MS-AZR-0145P\",\"EntitlementId\":\"58968085-83C6-49C1-B91A-7CFA117DF168\",\"OfferName\":\"Microsoft Azure\",\"FriendlyName\":\"Azure\",\"Quantity\":1,\"UnitType\":\"Usage-based\",\"ParentSubscriptionId\":null,\"HasPurchasableAddons\":false,\"CreationDate\":\"2018-07-23T18:55:23.667Z\",\"EffectiveStartDate\":\"2018-07-23T00:00:00Z\",\"CommitmentEndDate\":\"9999-12-14T00:00:00Z\",\"Status\":\"active\",\"AutoRenewEnabled\":false,\"IsTrial\":false,\"BillingType\":\"usage\",\"BillingCycle\":\"monthly\",\"Actions\":[\"Cancel\",\"Edit\"],\"PartnerId\":null,\"SuspensionReasons\":null,\"AttentionNeeded\":false,\"AttentionReason\":null,\"ActionTaken\":false,\"ContractType\":\"subscription\",\"Links\":{\"Offer\":{\"Uri\":\"/offers/MS-AZR-0145P?country=US\",\"Method\":\"GET\",\"Headers\":[]},\"Self\":{\"Uri\":\"/customers/c7aa13ad-e62f-463d-a706-845ce80c14b3/subscriptions/58968085-83C6-49C1-B91A-7CFA117DF168\",\"Method\":\"GET\",\"Headers\":[]}},\"OrderId\":\"08AE509E-B29D-4803-BA0D-6FBB0EA6DDAC\",\"Attributes\":{\"Etag\":\"removed\",\"ObjectType\":\"Subscription\"}}", + "resourceNewValue": "{\"Id\":\"58968085-83C6-49C1-B91A-7CFA117DF168\",\"OfferId\":\"MS-AZR-0145P\",\"EntitlementId\":\"58968085-83C6-49C1-B91A-7CFA117DF168\",\"OfferName\":\"Microsoft Azure\",\"FriendlyName\":\"Azure\",\"Quantity\":1,\"UnitType\":\"Usage-based\",\"ParentSubscriptionId\":null,\"HasPurchasableAddons\":false,\"CreationDate\":\"2018-07-23T18:55:23.667Z\",\"EffectiveStartDate\":\"2018-07-23T00:00:00Z\",\"CommitmentEndDate\":\"9999-12-14T00:00:00Z\",\"Status\":\"active\",\"AutoRenewEnabled\":false,\"IsTrial\":false,\"BillingType\":\"usage\",\"BillingCycle\":\"monthly\",\"Actions\":[\"Cancel\",\"Edit\"],\"PartnerId\":null,\"SuspensionReasons\":null,\"AttentionNeeded\":false,\"AttentionReason\":null,\"ActionTaken\":false,\"ContractType\":\"subscription\",\"Links\":{\"Offer\":{\"Uri\":\"/offers/MS-AZR-0145P?country=US\",\"Method\":\"GET\",\"Headers\":[]},\"Self\":{\"Uri\":\"/customers/c7aa13ad-e62f-463d-a706-845ce80c14b3/subscriptions/58968085-83C6-49C1-B91A-7CFA117DF168\",\"Method\":\"GET\",\"Headers\":[]}},\"OrderId\":\"08AE509E-B29D-4803-BA0D-6FBB0EA6DDAC\",\"Attributes\":{\"Etag\":\"removed\",\"ObjectType\":\"Subscription\"}}", + "operationType": "update_subscription", + "originalCorrelationId": "fe5a1087-4e6f-4b52-fe1f-ec93c68c3d90", + "operationDate": "2018-07-23T19:01:26.0039212Z", + "operationStatus": "succeeded", + "customizedData": [ + { + "key": "SubscriptionId", + "value": "58968085-83C6-49C1-B91A-7CFA117DF168" + }, + { + "key": "OfferId", + "value": "MS-AZR-0145P" + }, + { + "key": "SubscriptionName", + "value": "Azure" + }, + { + "key": "Quantity", + "value": "1" + }, + { + "key": "Status", + "value": "Active" + }, + { + "key": "PartnerOnRecord", + "value": "None" + }, + { + "key": "ActionTaken", + "value": "False" + } + ], + "attributes": { + "objectType": "AuditRecord" + } + } + ], + "links": { + "self": { + "uri": "/auditrecords?startDate=2018-07-23&endDate=2018-07-24&size=30", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetAzureRateCard.json b/test/PowerShell.Tests/SessionRecords/GetAzureRateCard.json new file mode 100644 index 0000000..45a8144 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetAzureRateCard.json @@ -0,0 +1,31 @@ +{ + "locale": "en-US", + "currency": "USD", + "isTaxIncluded": false, + "meters": [ + { + "id": "d0bf9053-17c4-4fec-8502-4eb8376343a7", + "name": "Compute Hours", + "rates": { "0": 0.06545 }, + "tags": [], + "category": "Virtual Machines", + "subcategory": "Standard_F2 VM Low Priority (Windows)", + "region": "US West 2", + "unit": "Hours", + "includedQuantity": 0.0, + "effectiveDate": "2017-04-01T00:00:00Z" + }, + { + "id": "8b7672d4-16fc-446e-9935-cf2223c5290f", + "name": "Standard S3 Secondary Database Days", + "rates": { "0": 3.415045 }, + "tags": [], + "category": "Data Services", + "subcategory": "SQL Database", + "region": "KR South", + "unit": "Days", + "includedQuantity": 0.0, + "effectiveDate": "2017-02-01T00:00:00Z" + } + ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetAzureRateCardSharedServices.json b/test/PowerShell.Tests/SessionRecords/GetAzureRateCardSharedServices.json new file mode 100644 index 0000000..6757714 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetAzureRateCardSharedServices.json @@ -0,0 +1,31 @@ +{ + "locale": "en-US", + "currency": "USD", + "isTaxIncluded": false, + "meters": [ + { + "id": "d0bf9053-17c4-4fec-8502-4eb8376343a7", + "name": "Compute Hours", + "rates": { "0": 0.077 }, + "tags": [], + "category": "Virtual Machines", + "subcategory": "Standard_F2 VM Low Priority (Windows)", + "region": "US West 2", + "unit": "Hours", + "includedQuantity": 0.0, + "effectiveDate": "2017-04-01T00:00:00Z" + }, + { + "id": "8b7672d4-16fc-446e-9935-cf2223c5290f", + "name": "Standard S3 Secondary Database Days", + "rates": { "0": 4.0177 }, + "tags": [], + "category": "Data Services", + "subcategory": "SQL Database", + "region": "KR South", + "unit": "Days", + "includedQuantity": 0.0, + "effectiveDate": "2017-02-01T00:00:00Z" + } + ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetAzureUtilization.json b/test/PowerShell.Tests/SessionRecords/GetAzureUtilization.json new file mode 100644 index 0000000..1cf8d2f --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetAzureUtilization.json @@ -0,0 +1,790 @@ +{ + "totalCount": 37, + "items": [ + { + "usageStartTime": "2018-07-20T00:00:00+00:00", + "usageEndTime": "2018-07-21T00:00:00+00:00", + "resource": { + "id": "923978e1-fd3f-4bd5-a798-f4b533057e46", + "name": "Standard IO - Block Blob Delete Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0053, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-20T00:00:00+00:00", + "usageEndTime": "2018-07-21T00:00:00+00:00", + "resource": { + "id": "211e620c-ebcf-4db5-a7fd-996abebe9546", + "name": "Standard IO - Block Blob Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0094, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-20T00:00:00+00:00", + "usageEndTime": "2018-07-21T00:00:00+00:00", + "resource": { + "id": "ae106a5c-ed63-4017-a064-6b5b1cf818ad", + "name": "Standard IO - Page Blob Read Addtl IO Units", + "category": "Storage", + "subcategory": "", + "region": "" + }, + "quantity": 0.1725, + "unit": "10K Operations", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-20T00:00:00+00:00", + "usageEndTime": "2018-07-21T00:00:00+00:00", + "resource": { + "id": "8b78bc2f-b9e7-490b-b4b1-fefd13b41be8", + "name": "Standard IO - Page Blob Write Addtl IO Units", + "category": "Storage", + "subcategory": "", + "region": "" + }, + "quantity": 0.6663, + "unit": "10K Operations", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-20T00:00:00+00:00", + "usageEndTime": "2018-07-21T00:00:00+00:00", + "resource": { + "id": "b9e5e77c-a0b3-4a2c-9b8b-57fa54f31c52", + "name": "Standard IO - Table Batch Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0006, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "f8c187bb-5a47-46ae-b874-f186d207fff4", + "name": "Standard IO - Block Blob List Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0096, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "b9e5e77c-a0b3-4a2c-9b8b-57fa54f31c52", + "name": "Standard IO - Table Batch Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0146, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "8b78bc2f-b9e7-490b-b4b1-fefd13b41be8", + "name": "Standard IO - Page Blob Write Addtl IO Units", + "category": "Storage", + "subcategory": "", + "region": "" + }, + "quantity": 6.4544, + "unit": "10K Operations", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "d54686f0-77ff-43f3-9e7c-2099030d32a7", + "name": "DNS Queries (1M)", + "category": "Networking", + "subcategory": "DNS", + "region": "" + }, + "quantity": 0.000025, + "unit": "1M Queries", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/dns-prod/providers/Microsoft.Network/dnszones/contoso.club", + "location": "global", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "211e620c-ebcf-4db5-a7fd-996abebe9546", + "name": "Standard IO - Block Blob Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.2085, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "82a2e983-9683-4842-82b4-bb634c60c8be", + "name": "VM Replicated to Azure", + "category": "Recovery Services", + "subcategory": "Site Recovery", + "region": "" + }, + "quantity": 0.032256, + "unit": "1 VM", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.RecoveryServices/vaults/contosoASRWest", + "location": "westus", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "9995d93a-7d35-4d3f-9c69-7a7fea447ef4", + "name": "Data Transfer Out (GB)", + "category": "Networking", + "subcategory": "", + "region": "Zone 1" + }, + "quantity": 0.001708, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "c01a1eed-b19a-4aad-bb83-8d62cdc29778", + "name": "Standard IO - Page Blob Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 52.5949, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "ae106a5c-ed63-4017-a064-6b5b1cf818ad", + "name": "Standard IO - Page Blob Read Addtl IO Units", + "category": "Storage", + "subcategory": "", + "region": "" + }, + "quantity": 1.4676, + "unit": "10K Operations", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "d3824379-dc7e-472b-9e67-3f4a7eadc05b", + "name": "Standard IO - Page Blob Read Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.3934, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "40551b4c-e8be-48ed-b70b-f8d25c7de724", + "name": "Standard IO - Block Blob Read Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 2.5991, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "d23a5753-ff85-4ddf-af28-8cc5cf2d3882", + "name": "Standard IO - Page Blob/Disk (GB)", + "category": "Storage", + "subcategory": "Locally Redundant", + "region": "" + }, + "quantity": 0.450133, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "32c3ebec-1646-49e3-8127-2cafbd3a04d8", + "name": "Data Transfer In (GB)", + "category": "Networking", + "subcategory": "", + "region": "Zone 1" + }, + "quantity": 1.062706, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "8f967c58-b144-4bd7-8882-8bf02767c839", + "name": "Zones", + "category": "Networking", + "subcategory": "DNS", + "region": "" + }, + "quantity": 0.032258064516129, + "unit": "DNS Zones", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/dns-prod/providers/Microsoft.Network/dnszones/contoso.club", + "location": "global", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "923978e1-fd3f-4bd5-a798-f4b533057e46", + "name": "Standard IO - Block Blob Delete Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.1187, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-21T00:00:00+00:00", + "usageEndTime": "2018-07-22T00:00:00+00:00", + "resource": { + "id": "3f2b1e1c-c886-4ec6-ad6f-dd0ef38819c9", + "name": "Standard IO - Table (GB)", + "category": "Storage", + "subcategory": "Locally Redundant", + "region": "" + }, + "quantity": 0.000179, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "f8c187bb-5a47-46ae-b874-f186d207fff4", + "name": "Standard IO - Block Blob List Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0096, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "b9e5e77c-a0b3-4a2c-9b8b-57fa54f31c52", + "name": "Standard IO - Table Batch Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.0146, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "8b78bc2f-b9e7-490b-b4b1-fefd13b41be8", + "name": "Standard IO - Page Blob Write Addtl IO Units", + "category": "Storage", + "subcategory": "", + "region": "" + }, + "quantity": 6.5337, + "unit": "10K Operations", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "d54686f0-77ff-43f3-9e7c-2099030d32a7", + "name": "DNS Queries (1M)", + "category": "Networking", + "subcategory": "DNS", + "region": "" + }, + "quantity": 0.000019, + "unit": "1M Queries", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/dns-prod/providers/Microsoft.Network/dnszones/contoso.club", + "location": "global", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "211e620c-ebcf-4db5-a7fd-996abebe9546", + "name": "Standard IO - Block Blob Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.209, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "82a2e983-9683-4842-82b4-bb634c60c8be", + "name": "VM Replicated to Azure", + "category": "Recovery Services", + "subcategory": "Site Recovery", + "region": "" + }, + "quantity": 0.032256, + "unit": "1 VM", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.RecoveryServices/vaults/contosoASRWest", + "location": "westus", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "9995d93a-7d35-4d3f-9c69-7a7fea447ef4", + "name": "Data Transfer Out (GB)", + "category": "Networking", + "subcategory": "", + "region": "Zone 1" + }, + "quantity": 0.001715, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "c01a1eed-b19a-4aad-bb83-8d62cdc29778", + "name": "Standard IO - Page Blob Write Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 53.6768, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "ae106a5c-ed63-4017-a064-6b5b1cf818ad", + "name": "Standard IO - Page Blob Read Addtl IO Units", + "category": "Storage", + "subcategory": "", + "region": "" + }, + "quantity": 1.4858, + "unit": "10K Operations", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "d3824379-dc7e-472b-9e67-3f4a7eadc05b", + "name": "Standard IO - Page Blob Read Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.3954, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "40551b4c-e8be-48ed-b70b-f8d25c7de724", + "name": "Standard IO - Block Blob Read Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 2.6123, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "d23a5753-ff85-4ddf-af28-8cc5cf2d3882", + "name": "Standard IO - Page Blob/Disk (GB)", + "category": "Storage", + "subcategory": "Locally Redundant", + "region": "" + }, + "quantity": 0.45231, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "32c3ebec-1646-49e3-8127-2cafbd3a04d8", + "name": "Data Transfer In (GB)", + "category": "Networking", + "subcategory": "", + "region": "Zone 1" + }, + "quantity": 1.077082, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "8f967c58-b144-4bd7-8882-8bf02767c839", + "name": "Zones", + "category": "Networking", + "subcategory": "DNS", + "region": "" + }, + "quantity": 0.032258064516129, + "unit": "DNS Zones", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/dns-prod/providers/Microsoft.Network/dnszones/contoso.club", + "location": "global", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "923978e1-fd3f-4bd5-a798-f4b533057e46", + "name": "Standard IO - Block Blob Delete Operation Units (in 10,000s)", + "category": "Data Management", + "subcategory": "", + "region": "" + }, + "quantity": 0.1192, + "unit": "10,000s", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + }, + { + "usageStartTime": "2018-07-22T00:00:00+00:00", + "usageEndTime": "2018-07-23T00:00:00+00:00", + "resource": { + "id": "3f2b1e1c-c886-4ec6-ad6f-dd0ef38819c9", + "name": "Standard IO - Table (GB)", + "category": "Storage", + "subcategory": "Locally Redundant", + "region": "" + }, + "quantity": 0.000205, + "unit": "GB", + "infoFields": {}, + "instanceData": { + "resourceUri": "/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/resourceGroups/ASRWest/providers/Microsoft.Storage/storageAccounts/contosoclubasrwestus", + "location": "uswest", + "partNumber": "", + "orderNumber": "" + }, + "attributes": { "objectType": "AzureUtilizationRecord" } + } + ], + "links": { + "self": { + "uri": "customers/278aaea7-4b3f-4a69-a115-ab07bf793396/subscriptions/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/utilizations/azure?start_time=2018-07-21T00:00:00Z&end_time=2018-07-23T00:00:00Z&granularity=Daily&show_details=True&size=1000", + "method": "GET", + "headers": [] + } + }, + "attributes": { "objectType": "Collection" } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-CN.json b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-CN.json new file mode 100644 index 0000000..1012ac2 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-CN.json @@ -0,0 +1,15 @@ +{ + "iso2Code": "CN", + "defaultCulture": "zh-CN", + "isStateRequired": true, + "supportedStatesList": [ "AH", "BJ", "CQ", "FJ", "GD", "GS", "GX", "GZ", "HA", "HB", "HE", "HI", "HL", "HN", "JL", "JS", "JX", "LN", "NM", "NX", "QH", "SC", "SD", "SH", "SN", "SX", "TJ", "XJ", "XZ", "YN", "ZJ" ], + "supportedLanguagesList": [ "zh-CHS", "en" ], + "supportedCulturesList": [ "zh-CN", "en-US" ], + "isPostalCodeRequired": true, + "postalCodeRegex": "^[0-9]{6,6}$", + "isCityRequired": true, + "isVatIdSupported": false, + "isTaxIdSupported": false, + "isTaxIdOptional": false, + "countryCallingCodesList": [ "86" ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-DE.json b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-DE.json new file mode 100644 index 0000000..fc8b046 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-DE.json @@ -0,0 +1,17 @@ +{ + "iso2Code": "DE", + "defaultCulture": "de-DE", + "isStateRequired": false, + "supportedStatesList": [], + "supportedLanguagesList": [ "en", "de" ], + "supportedCulturesList": [ "de-DE", "en-US" ], + "isPostalCodeRequired": true, + "postalCodeRegex": "^[0-9]{5,5}$", + "isCityRequired": true, + "isVatIdSupported": true, + "taxIdFormat": "DE#########", + "vatIdRegex": "^DE[\\d]{9,9}$", + "isTaxIdSupported": false, + "isTaxIdOptional": true, + "countryCallingCodesList": [ "49" ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-GB.json b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-GB.json new file mode 100644 index 0000000..5f17400 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-GB.json @@ -0,0 +1,17 @@ +{ + "iso2Code": "GB", + "defaultCulture": "en-GB", + "isStateRequired": false, + "supportedStatesList": [], + "supportedLanguagesList": [ "en" ], + "supportedCulturesList": [ "en-GB", "en-US" ], + "isPostalCodeRequired": true, + "postalCodeRegex": "^([gG][iI][rR][ ]?0[aA]{2,2}|[a-zA-Z]([0-9][0-9a-zA-Z]?|[a-zA-Z][0-9][0-9a-zA-Z]?)[ ]?[0-9][a-zA-Z]{2,2})$", + "isCityRequired": true, + "isVatIdSupported": true, + "taxIdFormat": "GB#########", + "vatIdRegex": "^GB(([\\d]{3,3}[\\d]{4,4}[\\d]{2,2}([\\d]{3,3})?)|((GD|HA)[\\d]{3,3}))$", + "isTaxIdSupported": false, + "isTaxIdOptional": true, + "countryCallingCodesList": [ "44" ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-US.json b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-US.json new file mode 100644 index 0000000..e9f819b --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCountryValidationRules-US.json @@ -0,0 +1,16 @@ +{ + "iso2Code": "US", + "defaultCulture": "en-US", + "isStateRequired": true, + "supportedStatesList": [ "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY" ], + "supportedLanguagesList": [ "en", "es" ], + "supportedCulturesList": [ "en-US", "es-US" ], + "isPostalCodeRequired": true, + "postalCodeRegex": "^\\d{5}(-\\d{4})?$", + "isCityRequired": true, + "isVatIdSupported": false, + "phoneNumberRegex": "^(1[ \\-\\/\\.]?)?(\\((\\d{3})\\)|(\\d{3}))[ \\-\\/\\.]?(\\d{3})[ \\-\\/\\.]?(\\d{4})$", + "isTaxIdSupported": true, + "isTaxIdOptional": true, + "countryCallingCodesList": [ "1" ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicies.json b/test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicies.json new file mode 100644 index 0000000..4e06344 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicies.json @@ -0,0 +1,47 @@ +{ + "totalCount": 3, + "items": [ + { + "id": "8c7d25aa-2dbb-409c-a1f0-f55bd9108fa9", + "name": "Windows 10 Enterprise E3", + "category": "o_o_b_e", + "description": "P462017 description", + "devicesAssigned": 0, + "policySettings": [ "oobe_user_not_local_admin", "skip_express_settings" ], + "createdDate": "2017-04-27T11:30:34.1944704-07:00", + "lastModifiedDate": "2017-04-27T11:30:34.1944704-07:00", + "attributes": { + "objectType": "ConfigurationPolicy" + } + }, + { + "id": "56edf752-ee77-4fd8-b7f5-df1f74a3a9ac", + "name": "Test policy", + "category": "o_o_b_e", + "description": "Test policy creation from API 1", + "devicesAssigned": 0, + "policySettings": [ "skip_express_settings" ], + "createdDate": "2017-07-25T11:03:03.8457088-07:00", + "lastModifiedDate": "2017-07-25T11:04:00.8150016-07:00", + "attributes": { + "objectType": "ConfigurationPolicy" + } + }, + { + "id": "a96b5fd9-0f3a-419a-b55c-a8aecd6b1f00", + "name": "Windows 10 Enterprise E5", + "category": "o_o_b_e", + "description": "test policy creation from API", + "devicesAssigned": 0, + "policySettings": [ "oobe_user_not_local_admin", "skip_express_settings" ], + "createdDate": "2017-07-25T11:07:36.1501184-07:00", + "lastModifiedDate": "2017-07-25T11:07:36.1501184-07:00", + "attributes": { + "objectType": "ConfigurationPolicy" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicyById.json b/test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicyById.json new file mode 100644 index 0000000..703e3dc --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerConfigurationPolicyById.json @@ -0,0 +1,16 @@ +{ + "id": "d57870f4-8465-48d5-8e57-a1e6d47894d0", + "name": "DefaultRoaming", + "category": "o_o_b_e", + "description": "Roaming", + "devicesAssignedCount": 1, + "policySettings": [ + "skip_express_settings", + "skip_eula" + ], + "createdDate": "2018-07-24T15:03:28.5483557-07:00", + "lastModifiedDate": "2018-07-24T15:03:28.5483557-07:00", + "attributes": { + "objectType": "ConfigurationPolicy" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerDevice.json b/test/PowerShell.Tests/SessionRecords/GetCustomerDevice.json new file mode 100644 index 0000000..3cb5d1b --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerDevice.json @@ -0,0 +1,26 @@ +{ + "totalCount": 1, + "items": [ + { + "id": "9a2b05d1-2f89-4688-9768-c104e76626a8", + "serialNumber": "R9-ZNP74", + "productKey": "00329-00000-0003-AA613", + "modelName": "Surface 7", + "oemManufacturerName": "Microsoft", + "policies": [ + { + "key": "o_o_b_e", + "value": "DefaultRoaming" + } + ], + "uploadedDate": "2018-07-24T15:03:40.3184992-07:00", + "attributes": { + "objectType": "Device" + } + } + ], + "links": {}, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerDeviceBatch.json b/test/PowerShell.Tests/SessionRecords/GetCustomerDeviceBatch.json new file mode 100644 index 0000000..ecadd05 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerDeviceBatch.json @@ -0,0 +1,21 @@ +{ + "totalCount": 1, + "items": [ + { + "id": "Testing1", + "creationDate": "0001-01-01T00:00:00", + "devicesCount": 1, + "devicesLink": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/deviceBatches/Testing1/devices", + "method": "GET", + "headers": [] + }, + "attributes": { + "objectType": "DeviceBatch" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerLicense.json b/test/PowerShell.Tests/SessionRecords/GetCustomerLicense.json new file mode 100644 index 0000000..2dc665a --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerLicense.json @@ -0,0 +1,99 @@ + { + "totalCount": 2, + "items": [ + { + "availableUnits": 4, + "activeUnits": 5, + "consumedUnits": 1, + "suspendedUnits": 0, + "totalUnits": 5, + "warningUnits": 0, + "productSku": { + "id": "efccb6f7-5641-4e0e-bd10-b4976e1bf68e", + "name": "Enterprise Mobility + Security E3", + "skuPartNumber": "EMS", + "targetType": "User", + "licenseGroupId": "group1" + }, + "servicePlans": [ + { + "displayName": "Azure Information Protection Premium P1", + "serviceName": "RMS_S_PREMIUM", + "id": "6c57d4b6-3b23-47a5-9bc9-69f17b4947b3", + "capabilityStatus": "Enabled", + "targetType": "User" + }, + { + "displayName": "Microsoft Intune A Direct", + "serviceName": "INTUNE_A", + "id": "c1ec4a95-1f05-45b3-a911-aa3fa01094f5", + "capabilityStatus": "Enabled", + "targetType": "User" + }, + { + "displayName": "Microsoft Azure Active Directory Rights", + "serviceName": "RMS_S_ENTERPRISE", + "id": "bea4c11e-220a-4e6d-8eb8-8ea15d019f90", + "capabilityStatus": "Enabled", + "targetType": "User" + }, + { + "displayName": "Azure Active Directory Premium P1", + "serviceName": "AAD_PREMIUM", + "id": "41781fb2-bc02-4b7c-bd55-b576c07bb09d", + "capabilityStatus": "Enabled", + "targetType": "User" + }, + { + "displayName": "Microsoft Azure Multi-Factor Authentication", + "serviceName": "MFA_PREMIUM", + "id": "8a256a2b-b617-496d-b51b-e76466e88db0", + "capabilityStatus": "Enabled", + "targetType": "User" + } + ], + "capabilityStatus": "Enabled", + "attributes": { + "objectType": "SubscribedSku" + } + }, + { + "availableUnits": 0, + "activeUnits": 1, + "consumedUnits": 1, + "suspendedUnits": 0, + "totalUnits": 1, + "warningUnits": 0, + "productSku": { + "id": "f8a1db68-be16-40ed-86d5-cb42ce701560", + "name": "Power BI Pro", + "skuPartNumber": "POWER_BI_PRO", + "targetType": "User", + "licenseGroupId": "group1" + }, + "servicePlans": [ + { + "displayName": "Exchange Foundation", + "serviceName": "EXCHANGE_S_FOUNDATION", + "id": "113feb6c-3fe4-4440-bddc-54d774bf0318", + "capabilityStatus": "Enabled", + "targetType": "Tenant" + }, + { + "displayName": "Power BI Pro", + "serviceName": "BI_AZURE_P2", + "id": "70d33638-9c74-4d01-bfd3-562de28bd4ba", + "capabilityStatus": "Enabled", + "targetType": "User" + } + ], + "capabilityStatus": "Enabled", + "attributes": { + "objectType": "SubscribedSku" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerLicenseByGroup.json b/test/PowerShell.Tests/SessionRecords/GetCustomerLicenseByGroup.json new file mode 100644 index 0000000..986c796 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerLicenseByGroup.json @@ -0,0 +1,129 @@ +{ + "totalCount": "04", + "items": [ + { + "availableUnits": 15, + "activeUnits": 15, + "consumedUnits": 0, + "suspendedUnits": 0, + "totalUnits": 15, + "warningUnits": 0, + "productSku": { + "id": "078d2b04-f1bd-4111-bbd4-b4b1b354cef4", + "name": "Azure Active Directory Premium P1", + "skuPartNumber": "AAD_PREMIUM", + "targetType": "User", + "licenseGroupId": "group1" + }, + "servicePlans": [ + { + "displayName": "Exchange Foundation", + "serviceName": "EXCHANGE_S_FOUNDATION", + "id": "113feb6c-3fe4-4440-bddc-54d774bf0318", + "capabilityStatus": "Enabled", + "targetType": "Tenant" + }, + { + "displayName": "Azure Active Directory Premium P1", + "serviceName": "AAD_PREMIUM", + "id": "41781fb2-bc02-4b7c-bd55-b576c07bb09d", + "capabilityStatus": "Enabled", + "targetType": "User" + }, + { + "displayName": "Microsoft Azure Multi-Factor Authentication", + "serviceName": "MFA_PREMIUM", + "id": "8a256a2b-b617-496d-b51b-e76466e88db0", + "capabilityStatus": "Enabled", + "targetType": "User" + } + ], + "capabilityStatus": "Enabled", + "attributes": { + "objectType": "SubscribedSku" + } + }, + { + "availableUnits": 1, + "activeUnits": 1, + "consumedUnits": 0, + "suspendedUnits": 0, + "totalUnits": 1, + "warningUnits": 0, + "productSku": { + "id": "54b84594-9c77-4499-8d65-5e0d5f410e78", + "name": "Dynamics AX Task", + "skuPartNumber": "AX_TASK_USER", + "targetType": "User", + "licenseGroupId": "group1" + }, + "servicePlans": [ + + ], + "capabilityStatus": "Enabled", + "attributes": { + "objectType": "SubscribedSku" + } + }, + { + "availableUnits": 23, + "activeUnits": 72, + "consumedUnits": 49, + "suspendedUnits": 0, + "totalUnits": 72, + "warningUnits": 0, + "productSku": { + "id": "984df360-9a74-4647-8cf8-696749f6247a", + "name": "Minecraft Education Edition Faculty", + "skuPartNumber": "CFQ7TTC0K5DR/0002", + "targetType": "User", + "licenseGroupId": "group2" + }, + "servicePlans": [ + + ], + "capabilityStatus": "Enabled", + "attributes": { + "objectType": "SubscribedSku" + } + }, + { + "availableUnits": 71, + "activeUnits": 112, + "consumedUnits": 41, + "suspendedUnits": 0, + "totalUnits": 112, + "warningUnits": 0, + "productSku": { + "id": "1e7e1070-8ccb-4aca-b470-d7cb538cb07e", + "name": "Windows 10 Enterprise E5", + "skuPartNumber": "WIN_ENT_E5", + "targetType": "User", + "licenseGroupId": "group1" + }, + "servicePlans": [ + { + "displayName": "Windows Defender Advanced Threat Protection", + "serviceName": "WINDEFATP", + "id": "871d91ec-ec1a-452b-a83f-bd76c7d770ef", + "capabilityStatus": "Enabled", + "targetType": "User" + }, + { + "displayName": "Windows 10 Enterprise E3", + "serviceName": "WIN10_PRO_ENT_SUB", + "id": "21b439ba-a0ca-424f-a6cc-52f954a5b111", + "capabilityStatus": "Enabled", + "targetType": "User" + } + ], + "capabilityStatus": "Enabled", + "attributes": { + "objectType": "SubscribedSku" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerLicenseUser.json b/test/PowerShell.Tests/SessionRecords/GetCustomerLicenseUser.json new file mode 100644 index 0000000..52d0d4c --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerLicenseUser.json @@ -0,0 +1,56 @@ + { + "totalCount": 1, + "items": [ + { + "servicePlans": [ + { + "displayName": "Azure Information Protection Premium P1", + "serviceName": "RMS_S_PREMIUM", + "id": "6c57d4b6-3b23-47a5-9bc9-69f17b4947b3", + "capabilityStatus": "Assigned", + "targetType": "User" + }, + { + "displayName": "Microsoft Intune A Direct", + "serviceName": "INTUNE_A", + "id": "c1ec4a95-1f05-45b3-a911-aa3fa01094f5", + "capabilityStatus": "Assigned", + "targetType": "User" + }, + { + "displayName": "Microsoft Azure Active Directory Rights", + "serviceName": "RMS_S_ENTERPRISE", + "id": "bea4c11e-220a-4e6d-8eb8-8ea15d019f90", + "capabilityStatus": "Assigned", + "targetType": "User" + }, + { + "displayName": "Azure Active Directory Premium P1", + "serviceName": "AAD_PREMIUM", + "id": "41781fb2-bc02-4b7c-bd55-b576c07bb09d", + "capabilityStatus": "Assigned", + "targetType": "User" + }, + { + "displayName": "Microsoft Azure Multi-Factor Authentication", + "serviceName": "MFA_PREMIUM", + "id": "8a256a2b-b617-496d-b51b-e76466e88db0", + "capabilityStatus": "Assigned", + "targetType": "User" + } + ], + "productSku": { + "id": "efccb6f7-5641-4e0e-bd10-b4976e1bf68e", + "name": "Enterprise Mobility + Security E3", + "skuPartNumber": "EMS", + "licenseGroupId": "group1" + }, + "attributes": { + "objectType": "License" + } + } + ], + "attributes": { + "objectType": "Collection" + } + } \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerManagedServices.json b/test/PowerShell.Tests/SessionRecords/GetCustomerManagedServices.json new file mode 100644 index 0000000..ffb16dc --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerManagedServices.json @@ -0,0 +1,55 @@ +{ + "totalCount": 2, + "items": [ + { + "id": "Exchange", + "name": "Exchange", + "groupName": "Office", + "links": { + "adminService": { + "uri": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=46a62ece-10ad-42e5-b3f1-b2ed53e6fc08&CSDEST=Exchange&InitialDomain=&PrimaryDomain=", + "method": "GET", + "headers": [] + }, + "serviceHealth": { + "uri": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=46a62ece-10ad-42e5-b3f1-b2ed53e6fc08&CSDEST=ServiceStatus", + "method": "GET", + "headers": [] + }, + "serviceTicket": { + "uri": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=46a62ece-10ad-42e5-b3f1-b2ed53e6fc08&CSDEST=Support", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "ManagedService" + } + }, + { + "id": "MicrosoftCommunicationsOnline", + "name": "SkypeforBusiness", + "groupName": "Office", + "links": { + "adminService": { + "uri": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=46a62ece-10ad-42e5-b3f1-b2ed53e6fc08&CSDEST=MicrosoftCommunicationsOnline", + "method": "GET", + "headers": [] + }, + "serviceHealth": { + "uri": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=46a62ece-10ad-42e5-b3f1-b2ed53e6fc08&CSDEST=ServiceStatus", + "method": "GET", + "headers": [] + }, + "serviceTicket": { + "uri": "https://portal.office.com/Partner/BeginClientSession.aspx?CTID=46a62ece-10ad-42e5-b3f1-b2ed53e6fc08&CSDEST=Support", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "ManagedService" + } + } + ] +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerSubscription.json b/test/PowerShell.Tests/SessionRecords/GetCustomerSubscription.json new file mode 100644 index 0000000..6cf4b4e --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerSubscription.json @@ -0,0 +1,85 @@ +{ + "totalCount": 2, + "items": [ + { + "id": "4F26A5CA-C468-4715-8FC5-A14F28BCC29B", + "offerId": "MS-AZR-0145P", + "entitlementId": "4F26A5CA-C468-4715-8FC5-A14F28BCC29B", + "offerName": "Microsoft Azure", + "friendlyName": "Microsoft Azure", + "quantity": 1, + "unitType": "Usage-based", + "hasPurchasableAddons": false, + "creationDate": "2018-04-04T17:08:20.71Z", + "effectiveStartDate": "2018-04-04T00:00:00Z", + "commitmentEndDate": "9999-12-14T00:00:00Z", + "status": "active", + "autoRenewEnabled": false, + "isTrial": false, + "billingType": "usage", + "billingCycle": "monthly", + "actions": [ "Cancel", "Edit" ], + "attentionNeeded": false, + "actionTaken": false, + "contractType": "subscription", + "links": { + "offer": { + "uri": "/offers/MS-AZR-0145P?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/subscriptions/4F26A5CA-C468-4715-8FC5-A14F28BCC29B", + "method": "GET", + "headers": [] + } + }, + "orderId": "89BABBF2-AFBB-42C6-82F9-FCD14668304D", + "attributes": { + "etag": "removed", + "objectType": "Subscription" + } + }, + { + "id": "B34024C7-9258-4841-BD0B-1E2A5D5C9D8D", + "offerId": "BD938F12-058F-4927-BBA3-AE36B1D2501C", + "entitlementId": "B34024C7-9258-4841-BD0B-1E2A5D5C9D8D", + "offerName": "Office 365 Business Essentials", + "friendlyName": "Office 365 Business Essentials", + "quantity": 1, + "unitType": "Licenses", + "hasPurchasableAddons": true, + "creationDate": "2018-03-26T21:41:51.677Z", + "effectiveStartDate": "2018-03-26T00:00:00Z", + "commitmentEndDate": "2019-03-26T00:00:00Z", + "status": "suspended", + "autoRenewEnabled": true, + "isTrial": false, + "billingType": "license", + "billingCycle": "monthly", + "actions": [ "Cancel", "Edit" ], + "suspensionReasons": [ "CustomerCancellation" ], + "attentionNeeded": false, + "actionTaken": false, + "contractType": "subscription", + "links": { + "offer": { + "uri": "/offers/BD938F12-058F-4927-BBA3-AE36B1D2501C?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/subscriptions/B34024C7-9258-4841-BD0B-1E2A5D5C9D8D", + "method": "GET", + "headers": [] + } + }, + "orderId": "06035D39-E52A-4B00-A0B4-4D2EB96E131B", + "attributes": { + "etag": "removed", + "objectType": "Subscription" + } + } + ], + "attributes": { "objectType": "Collection" } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerUserAll.json b/test/PowerShell.Tests/SessionRecords/GetCustomerUserAll.json new file mode 100644 index 0000000..5a8272a --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerUserAll.json @@ -0,0 +1,54 @@ +{ + "totalCount": 2, + "items": [ + { + "usageLocation": "US", + "id": "a9ef48bb-8758-4590-a312-d4a47bfaded4", + "userPrincipalName": "Daniel@dtdemocspcustomer005.onmicrosoft.com", + "firstName": "Daniel", + "lastName": "Tsai", + "displayName": "Daniel Tsai", + "userDomainType": "none", + "state": "active", + "links": { + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/users/a9ef48bb-8758-4590-a312-d4a47bfaded4", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "CustomerUser" + } + }, + { + "id": "6e668259-1f09-479d-bcb8-d9b03e826b8d", + "userPrincipalName": "admin@dtdemocspcustomer005.onmicrosoft.com", + "firstName": "Daniel", + "lastName": "Tsai", + "displayName": "DT Demo CSP Customer 005", + "userDomainType": "none", + "state": "active", + "links": { + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/users/6e668259-1f09-479d-bcb8-d9b03e826b8d", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "CustomerUser" + } + } + ], + "links": { + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/users", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerUserAllDeleted.json b/test/PowerShell.Tests/SessionRecords/GetCustomerUserAllDeleted.json new file mode 100644 index 0000000..5a52e09 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerUserAllDeleted.json @@ -0,0 +1,36 @@ +{ + "totalCount": 1, + "items": [ + { + "usageLocation": "US", + "id": "a45f1416-3300-4f65-9e8d-f123b397a4ea", + "userPrincipalName": "e83763f7f2204ac384cfcd49f79f2749@dtdemocspcustomer005.onmicrosoft.com", + "firstName": "Ferdinand", + "lastName": "Filibuster", + "displayName": "Ferdinand", + "userDomainType": "none", + "state": "inactive", + "softDeletionTime": "2017-01-20T00:33:34Z", + "links": { + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/users/a45f1416-3300-4f65-9e8d-f123b397a4ea", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "CustomerUser" + } + } + ], + "links": { + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/users?size=500&filter=%7B%22Field%22%3A%22UserStatus%22%2C%22Value%22%3A%22Inactive%22%2C%22Operator%22%3A%22equals%22%7D", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerUserById.json b/test/PowerShell.Tests/SessionRecords/GetCustomerUserById.json new file mode 100644 index 0000000..ecb2a47 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerUserById.json @@ -0,0 +1,18 @@ +{ + "usageLocation": "US", + "id": "482e2152-4b49-48ec-b715-823365ce3d4c", + "userPrincipalName": "testuser@contoso.onmicrosoft.com", + "firstName": "Jade", + "lastName": "Azul", + "displayName": "Jade Azul", + "userDomainType": "none", + "state": "active", + "links": { + "self": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/users/482e2152-4b49-48ec-b715-823365ce3d4c", + "method": "GET", + "headers": [] + } + }, + "attributes": { "objectType": "CustomerUser" } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetCustomerUserRoleById.json b/test/PowerShell.Tests/SessionRecords/GetCustomerUserRoleById.json new file mode 100644 index 0000000..82ad78f --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetCustomerUserRoleById.json @@ -0,0 +1,16 @@ +{ + "totalCount": 2, + "items": [ + { + "name": "Helpdesk Administrator", + "id": "729827e3-9c14-49f7-bb1b-9608f156bbb8", + "attributes": { "objectType": "DirectoryRole" } + }, + { + "name": "User Account Administrator", + "id": "fe930be7-5e62-47db-91af-98c3a49a38b1", + "attributes": { "objectType": "DirectoryRole" } + } + ], + "attributes": { "objectType": "Collection" } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetEntitlement.json b/test/PowerShell.Tests/SessionRecords/GetEntitlement.json new file mode 100644 index 0000000..13a6492 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetEntitlement.json @@ -0,0 +1,34 @@ +{ + "totalCount": 1, + "items": [ + { + "includedEntitlements": [], + "referenceOrder": { + "id": "mKkU4nkSuOtsip8UnqzVTDPIF8dXY7OE2", + "lineItemId": "0" + }, + "productId": "DZH318Z0BQ4C", + "quantity": 1, + "quantityDetails": [ + { + "quantity": 1, + "status": "PrefulfillmentPending" + } + ], + "entitledArtifacts": [ + { + "link": { + "uri": "/customers/46a62ece-10ad-42e5-b3f1-b2ed53e6fc08/artifacts/virtualmachinereservedinstance/groups/06459f5891ed490c97367eca8ac09bf3/lineitems/308d14c1-69d1-43ef-9fdd-64613197676f/resource/cbd8ad2f-9958-4a29-8a23-40cbebafa6b8", + "method": "GET", + "headers": [] + }, + "resourceId": "cbd8ad2f-9958-4a29-8a23-40cbebafa6b8", + "artifactType": "virtual_machine_reserved_instance" + } + ], + "skuId": "00BD", + "entitlementType": "virtual_machine_reserved_instance" + } + ], + "attributes": { "objectType": "Collection" } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetIndirectResellers.json b/test/PowerShell.Tests/SessionRecords/GetIndirectResellers.json new file mode 100644 index 0000000..78497c6 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetIndirectResellers.json @@ -0,0 +1,30 @@ +{ + "totalCount": 2, + "items": [ + { + "id": "484e548c-f5f3-4528-93a9-c16c6373cb59", + "name": "First Up Consultants", + "relationshipType": "is_indirect_cloud_solution_provider_of", + "state": "Active", + "mpnId": "4847383", + "location": "US", + "attributes": { + "objectType": "PartnerRelationship" + } + }, + { + "id": "b01b1487-b36e-4e6d-9b5e-0b58974c4b28", + "name": "ReleCloud", + "relationshipType": "is_indirect_cloud_solution_provider_of", + "state": "Active", + "mpnId": "4847433", + "location": "BR", + "attributes": { + "objectType": "PartnerRelationship" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetInvoice.json b/test/PowerShell.Tests/SessionRecords/GetInvoice.json new file mode 100644 index 0000000..6f3554b --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetInvoice.json @@ -0,0 +1,145 @@ +{ + "totalCount": 2, + "items": [ + { + "id": "D030001TFO", + "invoiceDate": "2018-07-15T00:00:00Z", + "totalCharges": -87993.07, + "paidAmount": 0.0, + "currencyCode": "USD", + "currencySymbol": "$", + "pdfDownloadLink": "/invoices/D030001TFO/documents/statement", + "invoiceDetails": [ + { + "invoiceLineItemType": "billing_line_items", + "billingProvider": "office", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO/lineitems/Office/BillingLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + }, + { + "invoiceLineItemType": "billing_line_items", + "billingProvider": "azure", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO/lineitems/Azure/BillingLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + }, + { + "invoiceLineItemType": "usage_line_items", + "billingProvider": "azure", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO/lineitems/Azure/UsageLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + } + ], + "documentType": "invoice", + "invoiceType": "Recurring", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Invoice" + } + }, + { + "id": "D030001TEE", + "invoiceDate": "2018-06-15T00:00:00Z", + "totalCharges": 90053.74, + "paidAmount": 0.0, + "currencyCode": "USD", + "currencySymbol": "$", + "pdfDownloadLink": "/invoices/D030001TEE/documents/statement", + "invoiceDetails": [ + { + "invoiceLineItemType": "billing_line_items", + "billingProvider": "office", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TEE/lineitems/Office/BillingLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + }, + { + "invoiceLineItemType": "billing_line_items", + "billingProvider": "azure", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TEE/lineitems/Azure/BillingLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + }, + { + "invoiceLineItemType": "usage_line_items", + "billingProvider": "azure", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TEE/lineitems/Azure/UsageLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + } + ], + "documentType": "invoice", + "invoiceType": "Recurring", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TEE", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Invoice" + } + } + ], + "links": { + "self": { + "uri": "/invoices", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetInvoiceById.json b/test/PowerShell.Tests/SessionRecords/GetInvoiceById.json new file mode 100644 index 0000000..254a209 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetInvoiceById.json @@ -0,0 +1,65 @@ +{ + "id": "D030001TFO", + "invoiceDate": "2018-07-15T00:00:00Z", + "totalCharges": -87993.07, + "paidAmount": 0.0, + "currencyCode": "USD", + "currencySymbol": "$", + "pdfDownloadLink": "/invoices/D030001TFO/documents/statement", + "invoiceDetails": [ + { + "invoiceLineItemType": "billing_line_items", + "billingProvider": "office", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO/lineitems/Office/BillingLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + }, + { + "invoiceLineItemType": "billing_line_items", + "billingProvider": "azure", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO/lineitems/Azure/BillingLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + }, + { + "invoiceLineItemType": "usage_line_items", + "billingProvider": "azure", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO/lineitems/Azure/UsageLineItems", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceDetail" + } + } + ], + "documentType": "invoice", + "invoiceType": "Recurring", + "links": { + "self": { + "uri": "/invoices/Recurring-D030001TFO", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Invoice" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetInvoiceLineItem.json b/test/PowerShell.Tests/SessionRecords/GetInvoiceLineItem.json new file mode 100644 index 0000000..29091fa --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetInvoiceLineItem.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetInvoiceSummary.json b/test/PowerShell.Tests/SessionRecords/GetInvoiceSummary.json new file mode 100644 index 0000000..657428c --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetInvoiceSummary.json @@ -0,0 +1,53 @@ +{ + "totalCount": 1, + "items": [ + { + "balanceAmount": 68474.95, + "currencyCode": "USD", + "currencySymbol": "$", + "accountingDate": "2018-07-15T00:00:00Z", + "firstInvoiceCreationDate": "2015-09-15T00:00:00Z", + "lastPaymentDate": "0001-01-01T00:00:00", + "lastPaymentAmount": 0.0, + "latestInvoiceDate": "0001-01-01T00:00:00", + "details": [ + { + "invoiceType": "Recurring", + "summary": { + "balanceAmount": 68474.95, + "currencyCode": "USD", + "currencySymbol": "$", + "accountingDate": "2018-07-15T00:00:00Z", + "firstInvoiceCreationDate": "2015-09-15T00:00:00Z", + "lastPaymentDate": "0001-01-01T00:00:00", + "lastPaymentAmount": 0.0, + "latestInvoiceDate": "0001-01-01T00:00:00", + "attributes": { + "objectType": "InvoiceSummary" + } + } + } + ], + "links": { + "self": { + "uri": "/invoices/summary", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "InvoiceSummary" + } + } + ], + "links": { + "self": { + "uri": "/invoices/summaries", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetOfferAddon.json b/test/PowerShell.Tests/SessionRecords/GetOfferAddon.json new file mode 100644 index 0000000..3b98f78 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetOfferAddon.json @@ -0,0 +1,103 @@ +{ + "totalCount": 2, + "items": [ + { + "id": "2828BE95-46BA-4F91-B2FD-0BEF192ECF60", + "name": "Exchange Online Archiving for Exchange Online", + "description": "A personal e-mail archive for users who have mailboxes on Exchange Server 2010 or later.", + "minimumQuantity": 1, + "maximumQuantity": 10000000, + "rank": 200, + "uri": "/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/2828BE95-46BA-4F91-B2FD-0BEF192ECF60", + "locale": "en-US", + "country": "US", + "category": { + "id": "", + "name": "", + "rank": 0, + "locale": "en-us", + "country": "US", + "attributes": { + "objectType": "OfferCategory" + } + }, + "prerequisiteOffers": [ "35A36B80-270A-44BF-9290-00545D350866", "6FBAD345-B7DE-42A6-B6AB-79B363D0B371", "91FD106F-4B2C-4938-95AC-F54F74E9A239", "195416C1-3447-423A-B37B-EE59A99A19C4", "22A70120-4078-4926-9592-39ED91CB9C01", "2A727AE4-F201-497D-A9D6-C6A892DF4A87", "BD938F12-058F-4927-BBA3-AE36B1D2501C", "031C9E47-4802-4248-838E-778FB1D2CC05", "B2016E73-D9AD-4758-B8B8-D5C001BDF411", "AA98032C-5403-472F-B24F-F6654846B15D" ], + "isAddOn": true, + "isAvailableForPurchase": true, + "billing": "license", + "isAutoRenewable": true, + "salesGroupId": "1", + "product": { + "id": "EE02FD1B-340E-4A4B-B355-4A514E4C8943", + "name": "Exchange Online Archiving for Exchange Online", + "unit": "Licenses" + }, + "unitType": "Licenses", + "links": { + "learnMore": { + "uri": "http://g.microsoftonline.com/0BXPS00en-us/1302", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/offers/2828BE95-46BA-4F91-B2FD-0BEF192ECF60?country=US", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Offer" + } + }, + { + "id": "45320EC9-9B8E-49D0-B900-F14141A0ABD1", + "name": "Microsoft MyAnalytics", + "description": "Microsoft MyAnalytics provides insights about time and relationships to help individuals and teams achieve more at work.", + "minimumQuantity": 1, + "maximumQuantity": 10000000, + "rank": 232, + "uri": "/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/45320EC9-9B8E-49D0-B900-F14141A0ABD1", + "locale": "en-US", + "country": "US", + "category": { + "id": "", + "name": "", + "rank": 0, + "locale": "en-us", + "country": "US", + "attributes": { + "objectType": "OfferCategory" + } + }, + "prerequisiteOffers": [ "195416C1-3447-423A-B37B-EE59A99A19C4", "2F707C7C-2433-49A5-A437-9CA7CF40D3EB", "91FD106F-4B2C-4938-95AC-F54F74E9A239", "796B6B5F-613C-4E24-A17C-EBA730D49C02", "8909E28E-5832-42F4-9886-B0A5545F3645", "2B3B8D2D-10AA-4BE4-B5FD-7F2FEB0C3091" ], + "isAddOn": true, + "isAvailableForPurchase": true, + "billing": "license", + "isAutoRenewable": true, + "salesGroupId": "1", + "product": { + "id": "90A8F363-DA30-4ECD-90A7-D3A6B203486D", + "name": "Microsoft MyAnalytics", + "unit": "Licenses" + }, + "unitType": "Licenses", + "links": { + "learnMore": { + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/offers/45320EC9-9B8E-49D0-B900-F14141A0ABD1?country=US", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Offer" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetPartnerLegalProfile.json b/test/PowerShell.Tests/SessionRecords/GetPartnerLegalProfile.json new file mode 100644 index 0000000..dcaba0c --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetPartnerLegalProfile.json @@ -0,0 +1,42 @@ +{ + "companyName": "Lucerne Publishing", + "address": { + "country": "US", + "city": "Buffalo", + "state": "NY", + "addressLine1": "123 Main Street", + "addressLine2": "", + "postalCode": "98052", + "firstName": "Gena", + "lastName": "Soto", + "phoneNumber": "4255550100" + }, + "primaryContact": { + "firstName": "Gena", + "lastName": "Soto", + "email": "gena@lucernepublishing.com", + "phoneNumber": "4255550100" + }, + "companyApproverAddress": { + "country": "US", + "city": "Buffalo", + "state": "NY", + "addressLine1": "123 Main Street", + "addressLine2": "", + "postalCode": "98052" + }, + "companyApproverEmail": "gena@lucernepublishing.com", + "vettingStatus": "authorized", + "vettingSubStatus": "none", + "profileType": "LegalBusinessProfile", + "links": { + "self": { + "uri": "/profiles/legalbusiness", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "LegalBusinessProfile" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetPartnerLicenseDeploymentInsights.json b/test/PowerShell.Tests/SessionRecords/GetPartnerLicenseDeploymentInsights.json new file mode 100644 index 0000000..1d5c1a5 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetPartnerLicenseDeploymentInsights.json @@ -0,0 +1,28 @@ +{ + "totalCount": 2, + "items": [ + { + "proratedDeploymentPercent": 0.0, + "licensesSold": 343, + "processedDateTime": "2017-03-10T00:00:00+00:00", + "serviceName": "crm", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesDeploymentInsights" + } + }, + { + "proratedDeploymentPercent": 1.0, + "licensesSold": 4464, + "processedDateTime": "2017-03-14T03:25:16.36+00:00", + "serviceName": "o365", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesDeploymentInsights" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetPartnerLicensesUsageInsights.json b/test/PowerShell.Tests/SessionRecords/GetPartnerLicensesUsageInsights.json new file mode 100644 index 0000000..c38ac51 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetPartnerLicensesUsageInsights.json @@ -0,0 +1,58 @@ +{ + "totalCount": 5, + "items": [ + { + "proratedLicensesUsagePercent": 0.0, + "workloadName": "Microsoft Dynamics CRM", + "processedDateTime": "2017-03-10T00:00:00+00:00", + "serviceName": "crm", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesUsageInsights" + } + }, + { + "proratedLicensesUsagePercent": 0.0, + "workloadName": "SharePoint", + "processedDateTime": "2017-03-10T00:00:00+00:00", + "serviceName": "crm", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesUsageInsights" + } + }, + { + "proratedLicensesUsagePercent": 0.0, + "workloadName": "Exchange", + "processedDateTime": "2017-03-09T00:00:00+00:00", + "serviceName": "o365", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesUsageInsights" + } + }, + { + "proratedLicensesUsagePercent": 0.0, + "workloadName": "SharePoint", + "processedDateTime": "2017-03-09T00:00:00+00:00", + "serviceName": "o365", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesUsageInsights" + } + }, + { + "proratedLicensesUsagePercent": 0.0, + "workloadName": "Skype For Business", + "processedDateTime": "2017-03-09T00:00:00+00:00", + "serviceName": "o365", + "channel": "reseller", + "attributes": { + "objectType": "PartnerLicensesUsageInsights" + } + } + ], + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetPartnerSupportProfile.json b/test/PowerShell.Tests/SessionRecords/GetPartnerSupportProfile.json new file mode 100644 index 0000000..896d0d3 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetPartnerSupportProfile.json @@ -0,0 +1,16 @@ +{ + "email": "email@sample.com", + "telephone": "4255555555", + "website": "www.microsoft.com", + "profileType": "support_profile", + "links": { + "self": { + "uri": "/v1/profiles/support", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "PartnerSupportProfile" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetProduct.json b/test/PowerShell.Tests/SessionRecords/GetProduct.json new file mode 100644 index 0000000..f284e2f --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetProduct.json @@ -0,0 +1,540 @@ +{ + "totalCount": 25, + "items": [ + { + "id": "9DEA7946-EC2C-441E-9FFD-E3B275F7E838", + "title": "Windows Azure Global", + "description": "", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/9DEA7946-EC2C-441E-9FFD-E3B275F7E838/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/9DEA7946-EC2C-441E-9FFD-E3B275F7E838?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4C", + "title": "DSv2 Series", + "description": "Dsv2-series instances are the latest generation of D-series instances that will carry more powerful CPUs which are on average about 35% faster than D-series instances, and carry the same memory and disk configurations as the D-series. Dsv2-series instances are based on the latest generation 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor, and with Intel Turbo Boost Technology 2.0 can go to 3.2 GHz.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4C/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4C?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4B", + "title": "D Series", + "description": "D-series virtual machines feature solid state drives (SSDs), fast CPUs and optimal CPU to memory configuration making them suitable for most general purpose applications. A subset of the D-series VMs also sport higher memory per CPU making them suitable for applications that require higher amounts of memory", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4B/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4B?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4Z", + "title": "NC Series", + "description": "N-series Virtual Machines are ideal for compute and graphics-intensive workloads, helping customers to fuel innovation through scenarios like high-end remote visualization, deep learning, and predictive analytics. N-series Virtual Machines feature the NVIDIA Tesla accelerated platform and NVIDIA GRID 2.0 technology, providing the highest-end graphics support available in the cloud today. In addition, N-series offers a NC24r configuration that provides a low latency, high-throughput network interface optimized for tightly coupled parallel computing workloads.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4Z/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4Z?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4R", + "title": "ESv3 Series", + "description": "Persistent storage disks are billed separately from virtual machines. To use premium storage disks, use the variant “Esv3” virtual machines.  The pricing and billing meters for Esv3 sizes are the same as Ev3-series.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4R/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4R?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4X", + "title": "Fv2 Series", + "description": "The Fv2-Series virtual machines support 2 GiB RAM and 8 GB of local temporary storage (SSD) per vCPU, and are optimized for compute intensive workloads. The F-Series is hyper-threaded and based on the 2.7 GHz Intel Xeon® Platinum 8168 (SkyLake) processor, which can achieve clock speeds as high as 3.7 GHz with the Intel Turbo Boost Technology 2.0. These virtual machines are suitable for scenarios like batch processing, web servers, analytics and gaming.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4X/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4X?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4P", + "title": "FS Series", + "description": "F-series VM sizes sport a higher CPU to memory ratio. They feature 2GB RAM and 16 GB of local solid state drive (SSD) per CPU core, and are optimized for compute intensive workloads. The F-series is based on the 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor,", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4P/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4P?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4S", + "title": "DS Series", + "description": "For persistent storage, use the variant “Ds” virtual machines and purchase Premium Storage separately. The pricing and billing meters for Ds sizes are the same as D-series.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4S/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4S?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4W", + "title": "M Series", + "description": "M-series virtual machines feature Intel® Xeon® E7-8890 v3 2.5GHz (Haswell) processor. The M-series provides up to 128 cores and 2.0TiB of memory providing unparalleled computational performance to support large in-memory workloads. All the M-series VM sizes will have the ability to use both standard and premium persistent disks. The pricing and billing meters for Ms sizes are the same as M-series.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4W/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4W?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4L", + "title": "Ev3 Series", + "description": "Ev3 instances are the latest generation of Memory Optimized Instances. E2-64 v3 instances are based on the 2.3 GHz Intel XEON ® E5-2673 v4 (Broadwell) processor and can achieve 3.5GHz with Intel Turbo Boost Technology 2.0. E2-64 v3 instances are ideal for memory-intensive enterprise applications", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4L/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4L?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4V", + "title": "L Series", + "description": "L-series family of Azure virtual machines are storage optimized VMs. These are ideal for applications requiring low latency, high throughput and large local disk storage. These VMs are built on Intel Haswell processor technology specifically E5 Xeon v3 processors with 4, 8, 16 and 32 core VM sizes. L-series supports up to 6 TB of local SSD and offers unmatched storage I/O", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4V/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4V?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4K", + "title": "Dv3 Series", + "description": "Dv3 instances are the latest generation of General Purpose Instances. D2-64 v3 instances are based on the 2.3 GHz Intel XEON ® E5-2673 v4 (Broadwell) processor and can achieve 3.5GHz with Intel Turbo Boost Technology 2.0. D2-64 v3 instances offer the combination of CPU, memory, and local disk for most production workloads.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4K/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4K?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ34", + "title": "Dv2 Series", + "description": "Dv2-series instances are the latest generation of D-series instances that will carry more powerful CPUs which are on average about 35% faster than D-series instances, and carry the same memory and disk configurations as the D-series. Dv2-series instances are based on the latest generation 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor, and with Intel Turbo Boost Technology 2.0 can go to 3.2 GHz.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ34/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ34?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ5B", + "title": "ND Series", + "description": "N-series Virtual Machines are ideal for compute and graphics-intensive workloads, helping customers to fuel innovation through scenarios like high-end remote visualization, deep learning, and predictive analytics. N-series Virtual Machines feature the NVIDIA Tesla accelerated platform and NVIDIA GRID 2.0 technology, providing the highest-end graphics support available in the cloud today. In addition, N-series offers a NC24r configuration that provides a low latency, high-throughput network interface optimized for tightly coupled parallel computing workloads.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ5B/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ5B?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4J", + "title": "H Series", + "description": "H series family of Azure virtual machines are next generation high performance computing VMs. These are ideal for high end computational needs, like molecular modeling, computational fluid dynamics and similar. These VMs are built on Intel Haswell processor technology specifically E5-2667 V3 processors with 8 and 16 core VM sizes both featuring DDR4 memory and local SSD based storage. The H-series line up offers, besides substantial CPU power, diverse options for RDMA and low latency capable networking using InfiniBand along with several memory configurations to support memory intensive computational requirements.)", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4J/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4J?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ35", + "title": "B Series", + "description": "B series VMs are Burstable SKUs that provide a low-cost option for workloads that typically run at a low to moderate baseline CPU performance but sometimes need to burst to significantly higher CPU performance when the demand rises. These are best suited for apps such as dev and test servers, low traffic web servers, small databases, micro services, build servers, code repositories that do not require use of the full CPU all the time and burst as needed to finish tasks.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ35/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ35?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ4T", + "title": "NV Series", + "description": "N-series Virtual Machines are ideal for compute and graphics-intensive workloads, helping customers to fuel innovation through scenarios like high-end remote visualization, deep learning, and predictive analytics. N-series Virtual Machines feature the NVIDIA Tesla accelerated platform and NVIDIA GRID 2.0 technology, providing the highest-end graphics support available in the cloud today. In addition, N-series offers a NC24r configuration that provides a low latency, high-throughput network interface optimized for tightly coupled parallel computing workloads.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4T/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4T?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ51", + "title": "F Series", + "description": "F-series VM sizes sport a higher CPU to memory ratio. They feature 2GB RAM and 16 GB of local solid state drive (SSD) per CPU core, and are optimized for compute intensive workloads. The F-series is based on the 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor, which can achieve clock speeds as high as 3.1 GHz with the Intel Turbo Boost Technology 2.0.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ51/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ51?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ5T", + "title": "NCv2 Series", + "description": "N-series Virtual Machines are ideal for compute and graphics-intensive workloads, helping customers to fuel innovation through scenarios like high-end remote visualization, deep learning, and predictive analytics. N-series Virtual Machines feature the NVIDIA Tesla accelerated platform and NVIDIA GRID 2.0 technology, providing the highest-end graphics support available in the cloud today. In addition, N-series offers a NC24r configuration that provides a low latency, high-throughput network interface optimized for tightly coupled parallel computing workloads.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ5T/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ5T?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DZH318Z0BQ50", + "title": "DSv3 Series", + "description": "Dv3 instances are the latest generation of General Purpose Instances. D2-64 v3 instances are based on the 2.3 GHz Intel XEON ® E5-2673 v4 (Broadwell) processor and can achieve 3.5GHz with Intel Turbo Boost Technology 2.0. D2-64 v3 instances offer the combination of CPU, memory, and local disk for most production workloads.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ50/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ50?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DG7GMGF0DWBM", + "title": "SQL Server 2017 Standard Core", + "description": "Get industry-leading performance and security on the platform of your choice, including Windows, Linux, and Docker. Gain real-time intelligence and deliver insights through modern analytical models and reports.", + "productType": { + "id": "Software", + "displayName": "Software" + }, + "links": { + "skus": { + "uri": "/products/DG7GMGF0DWBM/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DG7GMGF0DWBM?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DG7GMGF0DWBQ", + "title": "SQL Server 2017 Enterprise Core", + "description": "SQL Server Enterprise delivers comprehensive high-end datacenter capabilities for demanding database, business intelligence, and security requirements on the platform of your choice, including Windows, Linux, and Docker.", + "productType": { + "id": "Software", + "displayName": "Software" + }, + "links": { + "skus": { + "uri": "/products/DG7GMGF0DWBQ/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DG7GMGF0DWBQ?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DG7GMGF0DWT5", + "title": "Windows Server 2016 Standard", + "description": "Windows Server 2016 is the cloud-ready operating system that supports your current workloads while introducing new technologies that make it easy to transition to cloud computing when you are ready. It delivers powerful new layers of security along with Azure-inspired innovation for the applications and infrastructure that power your business. Windows Server 2016 Standard edition is ideal for customers with physical or minimally virtualized environments. Each purchase includes 16 core licenses and can be used to run 2 Operating System Environments (either virtual or physical). If your server has more than 16 cores, you will need to buy additional licenses (see Windows Server licensing page for details.) You also need to purchase Windows Server Client Access Licenses (CALs) for every user or device accessing the server.", + "productType": { + "id": "Software", + "displayName": "Software" + }, + "links": { + "skus": { + "uri": "/products/DG7GMGF0DWT5/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DG7GMGF0DWT5?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DG7GMGF0DS1K", + "title": "Windows Server 2016 Client Access License", + "description": "A Client Access License (CAL) is required for each user or device that accesses Windows Server 2016.", + "productType": { + "id": "Software", + "displayName": "Software" + }, + "links": { + "skus": { + "uri": "/products/DG7GMGF0DS1K/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DG7GMGF0DS1K?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "DG7GMGF0DWSN", + "title": "Rights Management Services (RMS) 2016 CAL", + "description": "A Client Access License (CAL) is required for each user or device that accesses the server software. Please purchase the appropriate number of user and device CALs for each user or device that accesses the server. ", + "productType": { + "id": "Software", + "displayName": "Software" + }, + "links": { + "skus": { + "uri": "/products/DG7GMGF0DWSN/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DG7GMGF0DWSN?country=US", + "method": "GET", + "headers": [] + } + } + } + ], + "links": { + "self": { + "uri": "/products?targetView=Azure&market=US", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetProductAvailability.json b/test/PowerShell.Tests/SessionRecords/GetProductAvailability.json new file mode 100644 index 0000000..8fc70fc --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetProductAvailability.json @@ -0,0 +1,35 @@ +{ + "totalCount": 1, + "items": [ + { + "id": "DZH318Z0RFQB", + "productId": "DZH318Z0BQ4C", + "skuId": "00FF", + "catalogItemId": "DZH318Z0BQ4C:00FF:DZH318Z0RFQB", + "defaultCurrency": { + "code": "USD", + "symbol": "$" + }, + "segment": "commercial", + "country": "US", + "isPurchasable": true, + "links": { + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/00FF/availabilities/DZH318Z0RFQB?country=US", + "method": "GET", + "headers": [] + } + } + } + ], + "links": { + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/00FF/availabilities?country=US", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetProductAvailabilityById.json b/test/PowerShell.Tests/SessionRecords/GetProductAvailabilityById.json new file mode 100644 index 0000000..768ca6b --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetProductAvailabilityById.json @@ -0,0 +1,20 @@ +{ + "id": "DZH318Z0RFQB", + "productId": "DZH318Z0BQ4C", + "skuId": "00FF", + "catalogItemId": "DZH318Z0BQ4C:00FF:DZH318Z0RFQB", + "defaultCurrency": { + "code": "USD", + "symbol": "$" + }, + "segment": "commercial", + "country": "US", + "isPurchasable": true, + "links": { + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/00FF/availabilities/DZH318Z0RFQB?country=US", + "method": "GET", + "headers": [] + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetProductByProductId.json b/test/PowerShell.Tests/SessionRecords/GetProductByProductId.json new file mode 100644 index 0000000..87b2967 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetProductByProductId.json @@ -0,0 +1,21 @@ +{ + "id": "DZH318Z0BQ4C", + "title": "DSv2 Series", + "description": "Dsv2-series instances are the latest generation of D-series instances that will carry more powerful CPUs which are on average about 35% faster than D-series instances, and carry the same memory and disk configurations as the D-series. Dsv2-series instances are based on the latest generation 2.4 GHz Intel Xeon® E5-2673 v3 (Haswell) processor, and with Intel Turbo Boost Technology 2.0 can go to 3.2 GHz.", + "productType": { + "id": "Azure", + "displayName": "Azure" + }, + "links": { + "skus": { + "uri": "/products/DZH318Z0BQ4C/skus?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4C?country=US", + "method": "GET", + "headers": [] + } + } + } \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetProductInventory.json b/test/PowerShell.Tests/SessionRecords/GetProductInventory.json new file mode 100644 index 0000000..9a5919d --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetProductInventory.json @@ -0,0 +1,44 @@ +[ + { + "productId": "DZH318Z0BQ3P", + "skuId": "0039", + "isRestricted": true, + "restrictions": [ + { + "reasonCode": "NotAvailableForSubscription", + "description": "Restriction identified of type 'Location' with values 'japanwest'.", + "properties": { + "type": "Location", + "values": "japanwest" + } + } + ] + }, + { + "productId": "DZH318Z0BQ3P", + "skuId": "0038", + "isRestricted": true, + "restrictions": [ + { + "reasonCode": "NotAvailableForSubscription", + "description": "Restriction identified of type 'Location' with values 'japanwest'.", + "properties": { + "type": "Location", + "values": "japanwest" + } + } + ] + }, + { + "productId": "DZH318Z0BQ3P", + "skuId": "000S", + "isRestricted": false, + "restrictions": [] + }, + { + "productId": "DZH318Z0BQ3P", + "skuId": "0011", + "isRestricted": false, + "restrictions": [] + } +] \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/GetProductSku.json b/test/PowerShell.Tests/SessionRecords/GetProductSku.json new file mode 100644 index 0000000..52cb857 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/GetProductSku.json @@ -0,0 +1,227 @@ +{ + "totalCount": 4, + "items": [ + { + "id": "0001", + "productId": "DZH318Z0BQ4C", + "title": "Reserved VM Instance, Standard_DS5_v2, AU East, 1 Year", + "description": "Reserved Virtual Machines Instance, Standard_DS5_v2, AU East, 1 Year", + "minimumQuantity": 1, + "maximumQuantity": 999999999, + "isTrial": false, + "supportedBillingCycles": [ + "one_time" + ], + "purchasePrerequisites": [ + "AzureSubscriptionRegistration", + "InventoryCheck" + ], + "inventoryVariables": [ + "CustomerId", + "AzureSubscriptionId" + ], + "provisioningVariables": [ + "Scope", + "SubscriptionId", + "Duration" + ], + "dynamicAttributes": { + "armRegionName": "australiaeast", + "armSkuName": "Standard_DS5_v2", + "category": "General purpose", + "cores": "16", + "diskSize": "224 Gb", + "duration": "1Year", + "ram": "56", + "region": "AU East", + "reservationsAutofitGroup": "DSv2 Series", + "reservationsAutofitRatio": "16", + "reservationSwappableArmSkuName": "Standard_D5_v2", + "shape": "DS5", + "skuDisplayName": "D5s v2", + "vCpu": "16" + }, + "links": { + "availabilities": { + "uri": "/products/DZH318Z0BQ4C/skus/0001/availabilities?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/0001?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "0002", + "productId": "DZH318Z0BQ4C", + "title": "Reserved VM Instance, Standard_DS2_v2, AU East, 3 Years", + "description": "Reserved Virtual Machines Instance, Standard_DS2_v2, AU East, 3 Years", + "minimumQuantity": 1, + "maximumQuantity": 999999999, + "isTrial": false, + "supportedBillingCycles": [ + "one_time" + ], + "purchasePrerequisites": [ + "AzureSubscriptionRegistration", + "InventoryCheck" + ], + "inventoryVariables": [ + "CustomerId", + "AzureSubscriptionId" + ], + "provisioningVariables": [ + "Scope", + "SubscriptionId", + "Duration" + ], + "dynamicAttributes": { + "armRegionName": "australiaeast", + "armSkuName": "Standard_DS2_v2", + "category": "General purpose", + "cores": "2", + "diskSize": "14 Gb", + "duration": "3Years", + "ram": "7", + "region": "AU East", + "reservationsAutofitGroup": "DSv2 Series", + "reservationsAutofitRatio": "2", + "reservationSwappableArmSkuName": "Standard_D2_v2", + "shape": "DS2", + "skuDisplayName": "D2s v2", + "vCpu": "2" + }, + "links": { + "availabilities": { + "uri": "/products/DZH318Z0BQ4C/skus/0002/availabilities?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/0002?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "00FF", + "productId": "DZH318Z0BQ4C", + "title": "Reserved VM Instance, Standard_DS1_v2, AU East, 1 Year", + "description": "Reserved Virtual Machines Instance, Standard_DS1_v2, AU East, 1 Year", + "minimumQuantity": 1, + "maximumQuantity": 999999999, + "isTrial": false, + "supportedBillingCycles": [ + "one_time" + ], + "purchasePrerequisites": [ + "AzureSubscriptionRegistration", + "InventoryCheck" + ], + "inventoryVariables": [ + "CustomerId", + "AzureSubscriptionId" + ], + "provisioningVariables": [ + "Scope", + "SubscriptionId", + "Duration" + ], + "dynamicAttributes": { + "armRegionName": "australiaeast", + "armSkuName": "Standard_DS1_v2", + "category": "General purpose", + "cores": "1", + "diskSize": "7 Gb", + "duration": "1Year", + "ram": "3.5", + "region": "AU East", + "reservationsAutofitGroup": "DSv2 Series", + "reservationsAutofitRatio": "1", + "reservationSwappableArmSkuName": "Standard_D1_v2", + "shape": "DS1", + "skuDisplayName": "D1s v2", + "vCpu": "1" + }, + "links": { + "availabilities": { + "uri": "/products/DZH318Z0BQ4C/skus/00FF/availabilities?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/00FF?country=US", + "method": "GET", + "headers": [] + } + } + }, + { + "id": "01H7", + "productId": "DZH318Z0BQ4C", + "title": "Reserved VM Instance, Standard_DS2_v2, AU Central 2, 3 Years", + "description": "Reserved Virtual Machines Instance, Standard_DS2_v2, AU Central 2, 3 Years", + "minimumQuantity": 1, + "maximumQuantity": 999999999, + "isTrial": false, + "supportedBillingCycles": [ + "one_time" + ], + "purchasePrerequisites": [ + "AzureSubscriptionRegistration", + "InventoryCheck" + ], + "inventoryVariables": [ + "CustomerId", + "AzureSubscriptionId" + ], + "provisioningVariables": [ + "Scope", + "SubscriptionId", + "Duration" + ], + "dynamicAttributes": { + "armRegionName": "australiacentral2", + "armSkuName": "Standard_DS2_v2", + "category": "General purpose", + "cores": "2", + "diskSize": "14 Gb", + "duration": "3Years", + "ram": "7", + "region": "AU Central 2", + "reservationsAutofitGroup": "DSv2 Series", + "reservationsAutofitRatio": "2", + "reservationSwappableArmSkuName": "Standard_D2_v2", + "shape": "DS2", + "skuDisplayName": "D2s v2", + "vCpu": "2" + }, + "links": { + "availabilities": { + "uri": "/products/DZH318Z0BQ4C/skus/01H7/availabilities?country=US", + "method": "GET", + "headers": [] + }, + "self": { + "uri": "/products/DZH318Z0BQ4C/skus/01H7?country=US", + "method": "GET", + "headers": [] + } + } + } + ], + "links": { + "self": { + "uri": "/products/DZH318Z0BQ4C/skus?country=US", + "method": "GET", + "headers": [] + } + }, + "attributes": { + "objectType": "Collection" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/UpdatePartnerLegalProfile.json b/test/PowerShell.Tests/SessionRecords/UpdatePartnerLegalProfile.json new file mode 100644 index 0000000..b0b83e6 --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/UpdatePartnerLegalProfile.json @@ -0,0 +1,46 @@ +{ + "CompanyName": "Lucerne Publishing", + "Address": { + "Country": "US", + "Region": null, + "City": "Bellevue", + "State": "WA", + "AddressLine1": "700 Bellevue Way NE", + "AddressLine2": "", + "PostalCode": "98004", + "FirstName": "John", + "LastName": "Doe", + "PhoneNumber": "425-555-5555" + }, + "PrimaryContact": { + "FirstName": "John", + "LastName": "Doe", + "Email": "jdoe@lucernepublishing.com", + "PhoneNumber": "4255550110" + }, + "CompanyApproverAddress": { + "Country": "US", + "Region": null, + "City": "Bellevue", + "State": "WA", + "AddressLine1": "700 Bellevue Way NE", + "AddressLine2": "", + "PostalCode": "98004", + "FirstName": null, + "LastName": null, + "PhoneNumber": null + }, + "CompanyApproverEmail": "jdoe@lucernepublishing.com", + "VettingStatus": "authorized", + "VettingSubStatus": "none", + "Links": { + "Self": { + "Uri": "/profiles/legalbusiness", + "Method": "GET", + "Headers": [] + } + }, + "Attributes": { + "ObjectType": "LegalBusinessProfile" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/SessionRecords/UpdatePartnerSupportProfile.json b/test/PowerShell.Tests/SessionRecords/UpdatePartnerSupportProfile.json new file mode 100644 index 0000000..842119f --- /dev/null +++ b/test/PowerShell.Tests/SessionRecords/UpdatePartnerSupportProfile.json @@ -0,0 +1,9 @@ +{ + "Email": "email@sample.com", + "Telephone": "4255555555", + "Website": "www.microsoft.com", + "ProfileType": "support_profile", + "Attributes": { + "ObjectType": "PartnerSupportProfile" + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/TestBase.cs b/test/PowerShell.Tests/TestBase.cs new file mode 100644 index 0000000..df37eca --- /dev/null +++ b/test/PowerShell.Tests/TestBase.cs @@ -0,0 +1,90 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests +{ + using System; + using System.Collections.ObjectModel; + using System.IO; + using System.Management.Automation; + using System.Reflection; + using Authentication; + using Factories; + + /// + /// Base class for Microsoft Partner Center PowerShell cmdlets unit tests. + /// + public abstract class TestBase + { + /// + /// Initializes a new instance of the class. + /// + protected TestBase() + { + Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory; + PartnerSession.Instance.AuthenticationFactory = new MockAuthenticationFactory(); + PartnerProfile.Instance.Context = new PartnerContext + { + CountryCode = "US", + Environment = EnvironmentName.GlobalCloud, + Locale = "en-US", + TenantId = "0e47c304-9333-4e49-84de-9cb7868b63bc", + Username = "bill@contoso.com" + }; + } + + /// + /// Run the specified test scripts. + /// + /// Function used to initialize the partner operations. + /// An array of functions to be invoked. + protected Collection RunPowerShellTest(Func initializeFunc, params string[] functions) + { + Collection output = null; + + PartnerSession.Instance.ClientFactory = new MockClientFactory(initializeFunc); + + using (PowerShell powershell = PowerShell.Create(RunspaceMode.NewRunspace)) + { + powershell.AddScript("$Error.clear()"); + powershell.AddScript($"Write-Debug \"Current directory: {AppDomain.CurrentDomain.BaseDirectory}\""); + powershell.AddScript($"Write-Debug \"Current executing assembly: {Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\""); + powershell.AddScript($"cd \"{AppDomain.CurrentDomain.BaseDirectory}\""); + + powershell.AddScript($"Import-Module \"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PartnerCenter.psd1")}\""); + powershell.AddScript($"Import-Module \"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Commands\\Common.ps1")}\""); + powershell.AddScript($"Import-Module \"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Commands\\{GetType().Name}.ps1")}\""); + + powershell.AddScript("$VerbosePreference='Continue'"); + powershell.AddScript("$DebugPreference='Continue'"); + powershell.AddScript("$ErrorActionPreference='Stop'"); + + foreach (string function in functions) + { + powershell.AddScript(function); + } + + try + { + powershell.Runspace.Events.Subscribers.Clear(); + output = powershell.Invoke(); + + if (powershell.Streams.Error.Count > 0) + { + throw new RuntimeException( + $"Test failed due to a non-empty error stream. First error: {PowerShellExtensions.FormatErrorRecord(powershell.Streams.Error[0])}{(powershell.Streams.Error.Count > 0 ? "Check the error stream in the test log for additional errors." : "")}"); + } + + return output; + } + finally + { + powershell.Streams.Error.Clear(); + } + } + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/Validations/AddressValidatorTests.cs b/test/PowerShell.Tests/Validations/AddressValidatorTests.cs new file mode 100644 index 0000000..35a880e --- /dev/null +++ b/test/PowerShell.Tests/Validations/AddressValidatorTests.cs @@ -0,0 +1,223 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace Microsoft.Store.PartnerCenter.PowerShell.Tests.Validations +{ + using Factories; + using Moq; + using PartnerCenter.Models; + using PartnerCenter.Models.CountryValidationRules; + using PowerShell.Validations; + using VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class AddressValidatorTests + { + /// + /// Unit test for an invalid address value. + /// + [ExpectedException(typeof(ValidationException))] + [TestMethod] + public void InvalidAddressValueTest() + { + Address address; + AddressValidator validator; + Mock partnerOperations; + + try + { + partnerOperations = new Mock(); + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("US").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-US")); + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(false); + + validator = new AddressValidator(partnerOperations.Object); + + address = new Address + { + AddressLine1 = "1 Microsoft Way", + City = "Redmond", + Country = "USA", + FirstName = "John", + LastName = "Doe", + PhoneNumber = "425-55-5555", + PostalCode = "98052", + State = "Washington" + }; + + Assert.AreEqual(true, validator.IsValid(address)); + } + finally + { + address = null; + partnerOperations = null; + validator = null; + } + } + + /// + /// Unit test to validate an address. + /// + [TestMethod] + public void IsValidCNAddress() + { + Address address; + AddressValidator validator; + Mock partnerOperations; + + try + { + partnerOperations = new Mock(); + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("CN").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-CN")); + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + + validator = new AddressValidator(partnerOperations.Object); + + address = new Address + { + AddressLine1 = "5 Danling Street", + City = "Haidian District", + Country = "CN", + FirstName = "John", + LastName = "Doe", + PhoneNumber = "(86-10) 5917-0101", + PostalCode = "100080", + State = "BJ" + }; + + Assert.AreEqual(true, validator.IsValid(address)); + } + finally + { + address = null; + partnerOperations = null; + validator = null; + } + } + + /// + /// Unit test to validate an address. + /// + [TestMethod] + public void IsValidGBAddress() + { + Address address; + AddressValidator validator; + Mock partnerOperations; + + try + { + partnerOperations = new Mock(); + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("GB").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-GB")); + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + + validator = new AddressValidator(partnerOperations.Object); + + address = new Address + { + AddressLine1 = "Manchester Business Park 3000 Aviator Way", + City = "Manchester", + Country = "GB", + FirstName = "John", + LastName = "Doe", + PhoneNumber = "0344 800 2400", + PostalCode = "M22 5TG" + }; + + Assert.AreEqual(true, validator.IsValid(address)); + } + finally + { + address = null; + partnerOperations = null; + validator = null; + } + } + + /// + /// Unit test to validate an address. + /// + [TestMethod] + public void IsValidDEAddress() + { + Address address; + AddressValidator validator; + Mock partnerOperations; + + try + { + partnerOperations = new Mock(); + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("DE").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-DE")); + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + + validator = new AddressValidator(partnerOperations.Object); + + address = new Address + { + AddressLine1 = "Walter-Gropius-Str. 5", + City = "München", + Country = "DE", + FirstName = "John", + LastName = "Doe", + PhoneNumber = "49 (89) 3176 4900", + PostalCode = "80807" + }; + + Assert.AreEqual(true, validator.IsValid(address)); + } + finally + { + address = null; + partnerOperations = null; + validator = null; + } + } + + /// + /// Unit test to validate an address. + /// + [TestMethod] + public void IsValidUSAddressTest() + { + Address address; + AddressValidator validator; + Mock partnerOperations; + + try + { + partnerOperations = new Mock(); + partnerOperations.Setup(p => p.CountryValidationRules.ByCountry("US").Get()) + .Returns(OperationFactory.Instance.GetResource("GetCountryValidationRules-US")); + partnerOperations.Setup(p => p.Validations.IsAddressValid(It.IsAny
())).Returns(true); + + validator = new AddressValidator(partnerOperations.Object); + + address = new Address + { + AddressLine1 = "1 Microsoft Way", + City = "Redmond", + Country = "US", + FirstName = "John", + LastName = "Doe", + PhoneNumber = "425-555-5555", + PostalCode = "98052", + State = "WA" + }; + + Assert.AreEqual(true, validator.IsValid(address)); + } + finally + { + address = null; + partnerOperations = null; + validator = null; + } + } + } +} \ No newline at end of file diff --git a/test/PowerShell.Tests/app.config b/test/PowerShell.Tests/app.config new file mode 100644 index 0000000..4903075 --- /dev/null +++ b/test/PowerShell.Tests/app.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/PowerShell.Tests/packages.config b/test/PowerShell.Tests/packages.config new file mode 100644 index 0000000..90ca085 --- /dev/null +++ b/test/PowerShell.Tests/packages.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file