From 206c5afad92f9dc2dfdafe197724a326f7e314c5 Mon Sep 17 00:00:00 2001 From: Isaiah Williams Date: Tue, 4 Dec 2018 13:59:29 -0600 Subject: [PATCH] Added the secure app model samples (#6) * Added the secure app model samples * Incorporated changes regarding the partner service settings. * Moved the KeyVault address to the configuration file. * Updated the NuGet packages for the CPV sample. Also, refactored the Key Vault provider to not create new instance of the HttpClient for each time a secret is requested. --- .github/ISSUE_TEMPLATE/BUG_REPORT.md | 28 ++ .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 19 ++ .github/PULL_REQUEST_TEMPLATE.md | 7 + CODE_OF_CONDUCT.md | 3 + CONTRIBUTING.md | 80 ++++++ README.md | 20 +- .../Settings.StyleCop | 15 -- nuget.config | 7 - sdk/README.md | 87 +++++++ .../SdkSamples.sln | 14 +- .../SdkSamples}/AggregatePartnerScenario.cs | 0 .../Agreements/CreateCustomerAgreement.cs | 0 .../Agreements/GetAgreementDetails.cs | 0 .../Agreements/GetAllCustomersAgreements.cs | 0 .../Agreements/GetCustomerAgreements.cs | 0 .../Agreements/ImportCustomersAgreement.cs | 0 .../GetCustomerLicensesDeploymentAnalytics.cs | 0 .../GetCustomerLicensesUsageAnalytics.cs | 0 .../GetPartnerLicensesDeploymentAnalytics.cs | 0 .../GetPartnerLicensesUsageAnalytics.cs | 0 .../SdkSamples}/App.config | 11 +- .../SdkSamples}/Auditing/QueryAuditRecords.cs | 0 .../Auditing/SearchAuditRecords.cs | 0 .../SearchAuditRecordsByCustomerId.cs | 0 .../SearchAuditRecordsByResourceType.cs | 0 .../SdkSamples}/BasePartnerScenario.cs | 0 .../SdkSamples}/Carts/CheckoutCart.cs | 0 .../SdkSamples}/Carts/CreateCart.cs | 0 ...CreateCartAddonWithExistingSubscription.cs | 0 .../SdkSamples}/Carts/CreateCartWithAddons.cs | 0 .../SdkSamples}/Carts/UpdateCart.cs | 0 .../ApplicationAuthenticationSection.cs | 0 .../Configuration/ConfigurationManager.cs | 0 .../PartnerServiceSettingsSection.cs | 0 .../Configuration/ScenarioSettingsSection.cs | 0 .../SdkSamples}/Configuration/Section.cs | 0 .../UserAuthenticationSection.cs | 22 -- .../SdkSamples}/Context/ScenarioContext.cs | 57 ++--- .../AddUserMemberToDirectoryRole.cs | 0 .../GetCustomerDirectoryRoleUserMembers.cs | 0 .../GetCustomerDirectoryRoles.cs | 0 ...moveCustomerUserMemberFromDirectoryRole.cs | 0 .../GetCustomerAvailabilities.cs | 0 ...etCustomerAvailabilitiesByTargetSegment.cs | 0 .../GetCustomerAvailability.cs | 0 .../CustomerProducts/GetCustomerProduct.cs | 0 .../CustomerProducts/GetCustomerProducts.cs | 0 .../GetCustomerProductsByTargetSegment.cs | 0 .../CustomerProducts/GetCustomerSku.cs | 0 .../GetCustomerSkuDownloadOptions.cs | 0 .../CustomerProducts/GetCustomerSkus.cs | 0 .../GetCustomerSkusByTargetSegment.cs | 0 .../GetCustomerServiceCostsLineItems.cs | 0 .../GetCustomerServiceCostsSummary.cs | 0 .../GetCustomerSubscribedSkus.cs | 0 .../CustomerUser/CreateCustomerUser.cs | 0 .../CustomerUserAssignGroup1Licenses.cs | 0 .../CustomerUserAssignGroup2Licenses.cs | 0 .../CustomerUserAssignLicenses.cs | 0 ...omerUserAssignedGroup1AndGroup2Licenses.cs | 0 .../CustomerUserAssignedGroup1Licenses.cs | 0 .../CustomerUserAssignedGroup2Licenses.cs | 0 .../CustomerUserAssignedLicenses.cs | 0 .../CustomerUser/CustomerUserRestore.cs | 0 .../CustomerUser/DeleteCustomerUser.cs | 0 .../CustomerUser/GetCustomerInactiveUsers.cs | 0 .../CustomerUser/GetCustomerUserCollection.cs | 0 .../CustomerUser/GetCustomerUserDetails.cs | 0 .../GetCustomerUserDirectoryRoles.cs | 0 .../CustomerUser/GetPagedCustomerUsers.cs | 0 .../CustomerUser/SortCustomerUsers.cs | 0 .../CustomerUser/UpdateCustomerUser.cs | 0 .../Customers/CheckDomainAvailability.cs | 0 .../SdkSamples}/Customers/CreateCustomer.cs | 0 .../Customers/DeleteCustomerFromTipAccount.cs | 0 .../DeletePartnerCustomerRelationship.cs | 0 .../SdkSamples}/Customers/FilterCustomers.cs | 0 .../Customers/GetCustomerDetails.cs | 0 .../Customers/GetCustomerManagedServices.cs | 0 .../Customers/GetCustomerQualification.cs | 0 .../GetCustomerRelationshipRequest.cs | 0 .../Customers/GetPagedCustomers.cs | 0 .../Customers/UpdateCustomerBillingProfile.cs | 0 .../Customers/UpdateCustomerQualification.cs | 0 .../UpdateCustomerQualificationWithGCC.cs | 0 .../Customers/ValidateCustomerAddress.cs | 0 .../CreateConfigurationPolicy.cs | 0 .../DevicesDeployment/CreateDeviceBatch.cs | 0 .../DevicesDeployment/CreateDevices.cs | 0 .../DeleteConfigurationPolicy.cs | 0 .../DevicesDeployment/DeleteDevice.cs | 0 .../GetAllConfigurationPolicies.cs | 0 .../DevicesDeployment/GetBatchUploadStatus.cs | 0 .../DevicesDeployment/GetDevices.cs | 0 .../DevicesDeployment/GetDevicesBatches.cs | 0 .../UpdateConfigurationPolicy.cs | 0 .../DevicesDeployment/UpdateDevicesPolicy.cs | 0 .../Entitlements/GetEntitlements.cs | 0 .../SdkSamples}/Helpers/ConsoleHelper.cs | 0 .../SdkSamples}/IPartnerScenario.cs | 0 .../SdkSamples}/IScenarioContext.cs | 0 .../CreateCustomerForIndirectReseller.cs | 0 .../GetCustomersOfIndirectReseller.cs | 0 .../IndirectModel/GetIndirectResellers.cs | 0 .../GetIndirectResellersOfCustomer.cs | 0 .../IndirectModel/GetSubscriptionsByMpnId.cs | 0 .../IndirectModel/PlaceOrderForCustomer.cs | 0 .../IndirectModel/VerifyPartnerMpnId.cs | 0 .../GetSubscriptionsByMpnId.cs | 0 .../IndirectPartners/VerifyPartnerMpnId.cs | 0 .../SdkSamples}/Invoice/GetAccountBalance.cs | 0 .../SdkSamples}/Invoice/GetInvoice.cs | 0 .../Invoice/GetInvoiceLineItems.cs | 0 .../Invoice/GetInvoiceStatement.cs | 0 .../Invoice/GetInvoiceSummaries.cs | 0 .../SdkSamples}/Invoice/GetPagedInvoices.cs | 0 .../Offers/GetCustomerOfferCategories.cs | 0 .../SdkSamples}/Offers/GetCustomerOffers.cs | 0 .../SdkSamples}/Offers/GetOffer.cs | 0 .../SdkSamples}/Offers/GetOfferCategories.cs | 0 .../SdkSamples}/Offers/GetOffers.cs | 0 .../SdkSamples}/Offers/GetPagedOffers.cs | 0 .../Orders/CreateAzureReservationOrder.cs | 0 .../SdkSamples}/Orders/CreateOrder.cs | 0 .../SdkSamples}/Orders/GetOrderDetails.cs | 0 .../Orders/GetOrderProvisioningStatus.cs | 0 .../SdkSamples}/Orders/GetOrders.cs | 0 .../Orders/GetOrdersByBillingCycleType.cs | 0 .../SdkSamples}/Orders/UpdateOrder.cs | 0 .../SdkSamples}/Products/CheckInventory.cs | 0 .../SdkSamples}/Products/GetAvailabilities.cs | 0 .../GetAvailabilitiesByTargetSegment.cs | 0 .../SdkSamples}/Products/GetAvailability.cs | 0 .../SdkSamples}/Products/GetProduct.cs | 0 .../SdkSamples}/Products/GetProducts.cs | 0 .../Products/GetProductsByTargetSegment.cs | 0 .../SdkSamples}/Products/GetSku.cs | 0 .../Products/GetSkuDownloadOptions.cs | 0 .../SdkSamples}/Products/GetSkus.cs | 0 .../Products/GetSkusByTargetSegment.cs | 0 .../SdkSamples}/Profile/GetBillingProfile.cs | 0 .../SdkSamples}/Profile/GetMPNProfile.cs | 0 .../Profile/GetOrganizationProfile.cs | 0 .../SdkSamples}/Profile/GetSupportProfile.cs | 0 .../Profile/GetlegalBusinessProfile.cs | 0 .../Profile/UpdateBillingProfile.cs | 0 .../Profile/UpdateLegalBusinessProfile.cs | 0 .../Profile/UpdateOrganizationProfile.cs | 0 .../Profile/UpdateSupportProfile.cs | 0 .../SdkSamples}/Program.cs | 0 .../SdkSamples}/Properties/AssemblyInfo.cs | 0 .../SdkSamples}/RateCards/GetAzureRateCard.cs | 0 .../RateCards/GetAzureSharedRateCard.cs | 0 .../GetCustomerSubscriptionsUsage.cs | 0 .../RatedUsage/GetCustomerUsageSummary.cs | 0 .../GetSubscriptionResourceUsage.cs | 0 .../RatedUsage/GetSubscriptionUsageRecords.cs | 0 .../RatedUsage/GetSubscriptionUsageSummary.cs | 0 .../AggregateScenarioExecutionStrategy.cs | 0 .../IScenarioExecutionStrategy.cs | 0 .../PromptExecutionStrategy.cs | 0 .../SdkSamples/SdkSamples.csproj | 43 +--- .../ServiceIncidents/GetServiceIncidents.cs | 0 .../CreatePartnerServiceRequest.cs | 0 .../GetCustomerServiceRequests.cs | 0 .../GetPagedPartnerServiceRequests.cs | 0 .../GetPartnerServiceRequestDetails.cs | 0 .../GetServiceRequestSupportTopics.cs | 0 .../UpdatePartnerServiceRequest.cs | 0 .../Subscriptions/AddSubscriptionAddOn.cs | 0 .../Subscriptions/ConvertTrialSubscription.cs | 0 .../Subscriptions/GetSubscription.cs | 0 .../GetSubscriptionProvisioningStatus.cs | 0 .../GetSubscriptionSupportContact.cs | 0 .../Subscriptions/GetSubscriptions.cs | 0 .../Subscriptions/GetSubscriptionsByOrder.cs | 0 .../Subscriptions/UpdateSubscription.cs | 0 .../UpdateSubscriptionSupportContact.cs | 0 .../Subscriptions/UpgradeSubscription.cs | 0 .../GetAzureSubscriptionUtilization.cs | 0 .../Validations/AddressValidation.cs | 0 .../Validations/ValidateAddress.cs | 0 .../SdkSamples}/packages.config | 7 +- secure-app-model/README.md | 5 + secure-app-model/keyvault/CPVApplication.sln | 25 ++ .../keyvault/CPVApplication/App.config | 47 ++++ .../CPVApplication/CPVApplication.csproj | 111 ++++++++ .../CPVApplication/CPVApplication.sln | 25 ++ .../keyvault/CPVApplication/Program.cs | 185 ++++++++++++++ .../CPVApplication/Properties/AssemblyInfo.cs | 36 +++ .../CPVApplication/Utilities/ApiCalls.cs | 140 ++++++++++ .../Utilities/AuthorizationUtilities.cs | 108 ++++++++ .../Utilities/KeyVaultProvider.cs | 71 ++++++ .../keyvault/CPVApplication/packages.config | 15 ++ secure-app-model/keyvault/CSPApplication.sln | 25 ++ .../keyvault/CSPApplication/App.config | 46 ++++ .../CSPApplication/CSPApplication.csproj | 109 ++++++++ .../keyvault/CSPApplication/Program.cs | 150 +++++++++++ .../CSPApplication/Properties/AssemblyInfo.cs | 36 +++ .../CSPApplication/Utilities/ApiCalls.cs | 141 ++++++++++ .../Utilities/AuthorizationUtilities.cs | 108 ++++++++ .../Utilities/KeyVaultProvider.cs | 37 +++ .../keyvault/CSPApplication/packages.config | 15 ++ secure-app-model/keyvault/PartnerConsent.sln | 25 ++ .../PartnerConsent/App_Start/BundleConfig.cs | 19 ++ .../PartnerConsent/App_Start/FilterConfig.cs | 18 ++ .../PartnerConsent/App_Start/RouteConfig.cs | 29 +++ .../PartnerConsent/App_Start/Startup.Auth.cs | 94 +++++++ .../PartnerConsent/ApplicationInsights.config | 2 + .../keyvault/PartnerConsent/Content/Site.css | 24 ++ .../Controllers/HomeController.cs | 33 +++ .../keyvault/PartnerConsent/Global.asax | 1 + .../keyvault/PartnerConsent/Global.asax.cs | 23 ++ .../PartnerConsent/PartnerConsent.csproj | 241 ++++++++++++++++++ .../PartnerConsent/Properties/AssemblyInfo.cs | 34 +++ .../keyvault/PartnerConsent/Startup.cs | 20 ++ .../Utilities/AuthorizationUtilities.cs | 110 ++++++++ .../Utilities/KeyVaultProvider.cs | 65 +++++ .../PartnerConsent/Views/Home/Index.cshtml | 19 ++ .../PartnerConsent/Views/Shared/Error.cshtml | 9 + .../Views/Shared/_Layout.cshtml | 16 ++ .../keyvault/PartnerConsent/Views/Web.config | 43 ++++ .../PartnerConsent/Views/_ViewStart.cshtml | 3 + .../keyvault/PartnerConsent/Web.Debug.config | 30 +++ .../PartnerConsent/Web.Release.config | 31 +++ .../keyvault/PartnerConsent/Web.config | 93 +++++++ .../keyvault/PartnerConsent/favicon.ico | Bin 0 -> 32038 bytes .../keyvault/PartnerConsent/packages.config | 30 +++ 228 files changed, 2731 insertions(+), 136 deletions(-) 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 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md delete mode 100644 Source/Partner Center SDK Samples/Settings.StyleCop delete mode 100644 nuget.config create mode 100644 sdk/README.md rename Partner Center SDK Samples.sln => sdk/SdkSamples.sln (61%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/AggregatePartnerScenario.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Agreements/CreateCustomerAgreement.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Agreements/GetAgreementDetails.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Agreements/GetAllCustomersAgreements.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Agreements/GetCustomerAgreements.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Agreements/ImportCustomersAgreement.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Analytics/GetCustomerLicensesDeploymentAnalytics.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Analytics/GetCustomerLicensesUsageAnalytics.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Analytics/GetPartnerLicensesDeploymentAnalytics.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Analytics/GetPartnerLicensesUsageAnalytics.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/App.config (96%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Auditing/QueryAuditRecords.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Auditing/SearchAuditRecords.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Auditing/SearchAuditRecordsByCustomerId.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Auditing/SearchAuditRecordsByResourceType.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/BasePartnerScenario.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Carts/CheckoutCart.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Carts/CreateCart.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Carts/CreateCartAddonWithExistingSubscription.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Carts/CreateCartWithAddons.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Carts/UpdateCart.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Configuration/ApplicationAuthenticationSection.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Configuration/ConfigurationManager.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Configuration/PartnerServiceSettingsSection.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Configuration/ScenarioSettingsSection.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Configuration/Section.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Configuration/UserAuthenticationSection.cs (78%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Context/ScenarioContext.cs (75%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerDirectoryRoles/AddUserMemberToDirectoryRole.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerDirectoryRoles/GetCustomerDirectoryRoleUserMembers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerDirectoryRoles/GetCustomerDirectoryRoles.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerDirectoryRoles/RemoveCustomerUserMemberFromDirectoryRole.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerAvailabilities.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerAvailabilitiesByTargetSegment.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerAvailability.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerProduct.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerProducts.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerProductsByTargetSegment.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerSku.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerSkuDownloadOptions.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerSkus.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerProducts/GetCustomerSkusByTargetSegment.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerServiceCosts/GetCustomerServiceCostsLineItems.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerServiceCosts/GetCustomerServiceCostsSummary.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerSubscribedSkus/GetCustomerSubscribedSkus.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CreateCustomerUser.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignGroup1Licenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignGroup2Licenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignLicenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignedGroup1AndGroup2Licenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignedGroup1Licenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignedGroup2Licenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserAssignedLicenses.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/CustomerUserRestore.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/DeleteCustomerUser.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/GetCustomerInactiveUsers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/GetCustomerUserCollection.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/GetCustomerUserDetails.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/GetCustomerUserDirectoryRoles.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/GetPagedCustomerUsers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/SortCustomerUsers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/CustomerUser/UpdateCustomerUser.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/CheckDomainAvailability.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/CreateCustomer.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/DeleteCustomerFromTipAccount.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/DeletePartnerCustomerRelationship.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/FilterCustomers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/GetCustomerDetails.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/GetCustomerManagedServices.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/GetCustomerQualification.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/GetCustomerRelationshipRequest.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/GetPagedCustomers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/UpdateCustomerBillingProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/UpdateCustomerQualification.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/UpdateCustomerQualificationWithGCC.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Customers/ValidateCustomerAddress.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/CreateConfigurationPolicy.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/CreateDeviceBatch.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/CreateDevices.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/DeleteConfigurationPolicy.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/DeleteDevice.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/GetAllConfigurationPolicies.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/GetBatchUploadStatus.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/GetDevices.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/GetDevicesBatches.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/UpdateConfigurationPolicy.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/DevicesDeployment/UpdateDevicesPolicy.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Entitlements/GetEntitlements.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Helpers/ConsoleHelper.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IPartnerScenario.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IScenarioContext.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/CreateCustomerForIndirectReseller.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/GetCustomersOfIndirectReseller.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/GetIndirectResellers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/GetIndirectResellersOfCustomer.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/GetSubscriptionsByMpnId.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/PlaceOrderForCustomer.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectModel/VerifyPartnerMpnId.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectPartners/GetSubscriptionsByMpnId.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/IndirectPartners/VerifyPartnerMpnId.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Invoice/GetAccountBalance.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Invoice/GetInvoice.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Invoice/GetInvoiceLineItems.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Invoice/GetInvoiceStatement.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Invoice/GetInvoiceSummaries.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Invoice/GetPagedInvoices.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Offers/GetCustomerOfferCategories.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Offers/GetCustomerOffers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Offers/GetOffer.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Offers/GetOfferCategories.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Offers/GetOffers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Offers/GetPagedOffers.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/CreateAzureReservationOrder.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/CreateOrder.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/GetOrderDetails.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/GetOrderProvisioningStatus.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/GetOrders.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/GetOrdersByBillingCycleType.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Orders/UpdateOrder.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/CheckInventory.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetAvailabilities.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetAvailabilitiesByTargetSegment.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetAvailability.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetProduct.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetProducts.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetProductsByTargetSegment.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetSku.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetSkuDownloadOptions.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetSkus.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Products/GetSkusByTargetSegment.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/GetBillingProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/GetMPNProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/GetOrganizationProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/GetSupportProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/GetlegalBusinessProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/UpdateBillingProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/UpdateLegalBusinessProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/UpdateOrganizationProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Profile/UpdateSupportProfile.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Program.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Properties/AssemblyInfo.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RateCards/GetAzureRateCard.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RateCards/GetAzureSharedRateCard.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RatedUsage/GetCustomerSubscriptionsUsage.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RatedUsage/GetCustomerUsageSummary.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RatedUsage/GetSubscriptionResourceUsage.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RatedUsage/GetSubscriptionUsageRecords.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/RatedUsage/GetSubscriptionUsageSummary.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ScenarioExecution/AggregateScenarioExecutionStrategy.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ScenarioExecution/IScenarioExecutionStrategy.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ScenarioExecution/PromptExecutionStrategy.cs (100%) rename Source/Partner Center SDK Samples/Partner Center SDK Samples.csproj => sdk/SdkSamples/SdkSamples.csproj (84%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceIncidents/GetServiceIncidents.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceRequests/CreatePartnerServiceRequest.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceRequests/GetCustomerServiceRequests.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceRequests/GetPagedPartnerServiceRequests.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceRequests/GetPartnerServiceRequestDetails.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceRequests/GetServiceRequestSupportTopics.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/ServiceRequests/UpdatePartnerServiceRequest.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/AddSubscriptionAddOn.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/ConvertTrialSubscription.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/GetSubscription.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/GetSubscriptionProvisioningStatus.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/GetSubscriptionSupportContact.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/GetSubscriptions.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/GetSubscriptionsByOrder.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/UpdateSubscription.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/UpdateSubscriptionSupportContact.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Subscriptions/UpgradeSubscription.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Utilization/GetAzureSubscriptionUtilization.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Validations/AddressValidation.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/Validations/ValidateAddress.cs (100%) rename {Source/Partner Center SDK Samples => sdk/SdkSamples}/packages.config (57%) create mode 100644 secure-app-model/README.md create mode 100644 secure-app-model/keyvault/CPVApplication.sln create mode 100644 secure-app-model/keyvault/CPVApplication/App.config create mode 100644 secure-app-model/keyvault/CPVApplication/CPVApplication.csproj create mode 100644 secure-app-model/keyvault/CPVApplication/CPVApplication.sln create mode 100644 secure-app-model/keyvault/CPVApplication/Program.cs create mode 100644 secure-app-model/keyvault/CPVApplication/Properties/AssemblyInfo.cs create mode 100644 secure-app-model/keyvault/CPVApplication/Utilities/ApiCalls.cs create mode 100644 secure-app-model/keyvault/CPVApplication/Utilities/AuthorizationUtilities.cs create mode 100644 secure-app-model/keyvault/CPVApplication/Utilities/KeyVaultProvider.cs create mode 100644 secure-app-model/keyvault/CPVApplication/packages.config create mode 100644 secure-app-model/keyvault/CSPApplication.sln create mode 100644 secure-app-model/keyvault/CSPApplication/App.config create mode 100644 secure-app-model/keyvault/CSPApplication/CSPApplication.csproj create mode 100644 secure-app-model/keyvault/CSPApplication/Program.cs create mode 100644 secure-app-model/keyvault/CSPApplication/Properties/AssemblyInfo.cs create mode 100644 secure-app-model/keyvault/CSPApplication/Utilities/ApiCalls.cs create mode 100644 secure-app-model/keyvault/CSPApplication/Utilities/AuthorizationUtilities.cs create mode 100644 secure-app-model/keyvault/CSPApplication/Utilities/KeyVaultProvider.cs create mode 100644 secure-app-model/keyvault/CSPApplication/packages.config create mode 100644 secure-app-model/keyvault/PartnerConsent.sln create mode 100644 secure-app-model/keyvault/PartnerConsent/App_Start/BundleConfig.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/App_Start/FilterConfig.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/App_Start/RouteConfig.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/App_Start/Startup.Auth.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/ApplicationInsights.config create mode 100644 secure-app-model/keyvault/PartnerConsent/Content/Site.css create mode 100644 secure-app-model/keyvault/PartnerConsent/Controllers/HomeController.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/Global.asax create mode 100644 secure-app-model/keyvault/PartnerConsent/Global.asax.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/PartnerConsent.csproj create mode 100644 secure-app-model/keyvault/PartnerConsent/Properties/AssemblyInfo.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/Startup.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/Utilities/AuthorizationUtilities.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/Utilities/KeyVaultProvider.cs create mode 100644 secure-app-model/keyvault/PartnerConsent/Views/Home/Index.cshtml create mode 100644 secure-app-model/keyvault/PartnerConsent/Views/Shared/Error.cshtml create mode 100644 secure-app-model/keyvault/PartnerConsent/Views/Shared/_Layout.cshtml create mode 100644 secure-app-model/keyvault/PartnerConsent/Views/Web.config create mode 100644 secure-app-model/keyvault/PartnerConsent/Views/_ViewStart.cshtml create mode 100644 secure-app-model/keyvault/PartnerConsent/Web.Debug.config create mode 100644 secure-app-model/keyvault/PartnerConsent/Web.Release.config create mode 100644 secure-app-model/keyvault/PartnerConsent/Web.config create mode 100644 secure-app-model/keyvault/PartnerConsent/favicon.ico create mode 100644 secure-app-model/keyvault/PartnerConsent/packages.config diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 0000000..53976f4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,28 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +# Steps to reproduce + +> What steps can reproduce the defect? +> Please share the setup, sample project, version of Java 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/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8be1d1f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d922ad2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,80 @@ +# Contributing to Partner Center .NET Samples + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to and actually do, grant us +the rights to use your contribution. View the [Contributor License Agreement](https://cla.microsoft.com) for more details. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +- [Code of Conduct](#code-of-conduct) +- [Issues and Bugs](#finding-issues) +- [Feature Requests](#requesting-features) +- [Submission Guidelines](#submission-guidelines) + +## Code of Conduct + +Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +## Finding Issues + +If you find a bug in the source code or a mistake in the documentation, you can help us by +[submitting an issue](#submitting-an-issue) to the GitHub Repository. Even better, you can +[submit a Pull Request](#submitting-a-pull-request) with a fix. + +## Requesting Features + +You can *request* a new feature by [submitting an issue](#submitting-an-issue) to the GitHub +Repository. If you would like to *implement* a new feature, please submit an issue with +a proposal for your work first, to be sure that we can use it. + +**Small Features** can be crafted and directly [submitted as a Pull Request](#submitting-a-pull-request). + +## Submission Guidelines + +### Submitting an Issue + +Before you submit an issue, search the archive, maybe your question was already answered. + +If your issue appears to be a bug and hasn't been reported, open a new issue. +Help us to maximize the effort we can spend fixing issues and add new +features, by not reporting duplicate issues. Providing the following information will increase the +chances of your issue being dealt with quickly: + +- **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps +- **Version** - what version is affected (e.g. 0.1.2) +- **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you +- **Browsers and Operating System** - is this a problem with all browsers? +- **Reproduce the Error** - provide a live example or an unambiguous set of steps +- **Related Issues** - has a similar issue been reported before? +- **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be + causing the problem (line of code or commit) + +You can file new issues by providing the above information at the [corresponding repository's issues link](https://github.com/Microsoft/Partner-Center-DotNet-Samples/issues/new). + +### Submitting a Pull Request + +Before you submit your Pull Request (PR) consider the following guidelines: + +- [Search the repository](https://github.com/Microsoft/Partner-Center-DotNet-Samples/pulls) for an open or closed PR + that relates to your submission. You don't want to duplicate effort. + +- Make your changes in a new git fork: + +- Commit your changes using a descriptive commit message +- Push your fork to GitHub: +- In GitHub, create a pull request +- If we suggest changes then: + - Make the required updates. + - Rebase your fork and force push to your GitHub repository (this will update your Pull Request): + + ```shell + git rebase master -i + git push -f + ``` + +That is it! Thank you for your contribution! \ No newline at end of file diff --git a/README.md b/README.md index 72f1506..27e0d05 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ +# Partner Center .NET Samples -# Contributing +This repository contains samples for the Partner Center .NET SDK. -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. +## Samples List -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. +| Sample Name | Description | +|-------------|-------------| +| [SDK Samples](sdk/README.md) | Console application that demonstrates each scenario the Partner Center .NET SDK is capable of performing.| +| [Secure App Model](secure-app-model/README.md) | A set of projects that demonstrate how a Control Panel Vendor (CPV) and a Cloud Solution Provider (CSP) should implement the Secure App Model. | -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +## Reporting Security Issues + +Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [secure@microsoft.com](mailto:secure@microsoft.com). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default). \ No newline at end of file diff --git a/Source/Partner Center SDK Samples/Settings.StyleCop b/Source/Partner Center SDK Samples/Settings.StyleCop deleted file mode 100644 index 18ba2fd..0000000 --- a/Source/Partner Center SDK Samples/Settings.StyleCop +++ /dev/null @@ -1,15 +0,0 @@ - - - - - False - - \.g\.cs$ - \.generated\.cs$ - \.g\.i\.cs$ - TemporaryGeneratedFile_.*\.cs$ - - - - - \ No newline at end of file diff --git a/nuget.config b/nuget.config deleted file mode 100644 index d596277..0000000 --- a/nuget.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/sdk/README.md b/sdk/README.md new file mode 100644 index 0000000..8959d37 --- /dev/null +++ b/sdk/README.md @@ -0,0 +1,87 @@ +# SDK Samples + +## Overview + +Console application that demonstrates each scenario the Partner Center .NET SDK is capable of performing. + +## Getting Started + +Before you build the application, update the values in the *App.config* file to reflect the Azure AD authentication information you created in [Partner Center authentication](https://docs.microsoft.com/partner-center/develop/partner-center-authentication). Specifically, you should use your integration sandbox account settings during early development or for testing in production. + +Under **ScenarioSettings** in the *App.config* file, you can set parameters that will be automatically passed into the scenarios that you run. + +To modify the list of scenarios that are run, comment out lines in **MainScenarios** or in an individual **Get Scenarios** method found in the *Program.cs* file. + +## Prerequisites + +With previous versions of this sample there were configurations for user credentials. Those configurations have been removed, and now you will be prompted to enter the credentials upon execution. This change was made due to the upcoming requirement to use multi-factor authentication (MFA) when access Partner Center and the Partner Center API using app + user authentication. Please note that the approach used by this application to obtain user credentials is just one way this operation can be performed. It is recommended that you review the [Secure App Model](../secure-app-model/README.md) sample for more information. + +### Azure Active Directory + +Perform the following task to correctly configure the Azure AD application for use with this sample project. + +1. Sign in to the [Partner Center](https://partner.microsoft.com/cloud-solution-provider/csp-partner) 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. + +## What to Change + +### PartnerServiceSettings + +If you are connecting to one of the sovereign clouds you will need to modify the values below. These values should not be modified if you are connecting to the commercial cloud. + +- PartnerServiceApiEndpoint +- AuthenticationAuthorityEndpoint +- GraphEndpoint + +All thees settings are necessary for the sample API calls to properly function. + +### AppAuthentication + +The following settings must be modified, so that each scenario functions as excepted + +- **ApplicationId**: Your Azure Active Directory application identifier, used for authentication +- **ApplicationSecret**: The application secret, associated with the specified Azure AD application +- **Domain**: The Azure Active Directory domain where the Azure AD application was created + +### UserAuthentication + +The following settings must be updated, so that each scenario functions as expected + +- **ApplicationId**: Your Azure Active Directory application identifier, used for authentication + +Do not change the following configurations + +- RedirectUrl +- ResourceUrl + +### ScenarioSettings + +Do not change the following setting + +- **CustomerDomainSuffix**: The domain suffix used when creating a new customer + +The following settings can be updated, if left blank information will need to be inputted when running a scenario where it is necessary + +- **CustomerIdToDelete**: The ID of the customer used for deletion. +- **DefaultCustomerId**: The customer ID to use in customer-related scenarios. +- **DefaultInvoiceId**: The invoice ID to use in invoice scenarios. +- **PartnerMpnId**: The partner MPN ID to use in indirect partner scenarios. +- **DefaultServiceRequestId**: The service request ID to use in service request scenarios. +- **DefaultSupportTopicId**: The support topic ID to use in service request scenarios. +- **DefaultOfferId**: The offer ID to use in offer scenarios. +- **DefaultOrderId**: The order ID to use in order scenarios. +- **DefaultSubscriptionId**: The subscription ID to use in subscription scenarios. + +Each of the following of settings specify the amount of entries per page when retrieving paged content. These settings can be modified if desired + +- CustomerPageSize +- DefaultOfferPageSize +- InvoicePageSize +- ServiceRequestPageSize +- SubscriptionPageSize \ No newline at end of file diff --git a/Partner Center SDK Samples.sln b/sdk/SdkSamples.sln similarity index 61% rename from Partner Center SDK Samples.sln rename to sdk/SdkSamples.sln index af8a941..cdb3831 100644 --- a/Partner Center SDK Samples.sln +++ b/sdk/SdkSamples.sln @@ -1,14 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2050 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Partner Center SDK Samples", "Source\Partner Center SDK Samples\Partner Center SDK Samples.csproj", "{AC93E5CC-549C-4F13-9675-A86860918C2B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9445B986-021F-44FE-BA08-92C43301F8AF}" - ProjectSection(SolutionItems) = preProject - nuget.config = nuget.config - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SdkSamples", "SdkSamples\SdkSamples.csproj", "{AC93E5CC-549C-4F13-9675-A86860918C2B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -24,4 +19,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8E53D670-F5E9-41B1-B567-8819B3AD3DCF} + EndGlobalSection EndGlobal diff --git a/Source/Partner Center SDK Samples/AggregatePartnerScenario.cs b/sdk/SdkSamples/AggregatePartnerScenario.cs similarity index 100% rename from Source/Partner Center SDK Samples/AggregatePartnerScenario.cs rename to sdk/SdkSamples/AggregatePartnerScenario.cs diff --git a/Source/Partner Center SDK Samples/Agreements/CreateCustomerAgreement.cs b/sdk/SdkSamples/Agreements/CreateCustomerAgreement.cs similarity index 100% rename from Source/Partner Center SDK Samples/Agreements/CreateCustomerAgreement.cs rename to sdk/SdkSamples/Agreements/CreateCustomerAgreement.cs diff --git a/Source/Partner Center SDK Samples/Agreements/GetAgreementDetails.cs b/sdk/SdkSamples/Agreements/GetAgreementDetails.cs similarity index 100% rename from Source/Partner Center SDK Samples/Agreements/GetAgreementDetails.cs rename to sdk/SdkSamples/Agreements/GetAgreementDetails.cs diff --git a/Source/Partner Center SDK Samples/Agreements/GetAllCustomersAgreements.cs b/sdk/SdkSamples/Agreements/GetAllCustomersAgreements.cs similarity index 100% rename from Source/Partner Center SDK Samples/Agreements/GetAllCustomersAgreements.cs rename to sdk/SdkSamples/Agreements/GetAllCustomersAgreements.cs diff --git a/Source/Partner Center SDK Samples/Agreements/GetCustomerAgreements.cs b/sdk/SdkSamples/Agreements/GetCustomerAgreements.cs similarity index 100% rename from Source/Partner Center SDK Samples/Agreements/GetCustomerAgreements.cs rename to sdk/SdkSamples/Agreements/GetCustomerAgreements.cs diff --git a/Source/Partner Center SDK Samples/Agreements/ImportCustomersAgreement.cs b/sdk/SdkSamples/Agreements/ImportCustomersAgreement.cs similarity index 100% rename from Source/Partner Center SDK Samples/Agreements/ImportCustomersAgreement.cs rename to sdk/SdkSamples/Agreements/ImportCustomersAgreement.cs diff --git a/Source/Partner Center SDK Samples/Analytics/GetCustomerLicensesDeploymentAnalytics.cs b/sdk/SdkSamples/Analytics/GetCustomerLicensesDeploymentAnalytics.cs similarity index 100% rename from Source/Partner Center SDK Samples/Analytics/GetCustomerLicensesDeploymentAnalytics.cs rename to sdk/SdkSamples/Analytics/GetCustomerLicensesDeploymentAnalytics.cs diff --git a/Source/Partner Center SDK Samples/Analytics/GetCustomerLicensesUsageAnalytics.cs b/sdk/SdkSamples/Analytics/GetCustomerLicensesUsageAnalytics.cs similarity index 100% rename from Source/Partner Center SDK Samples/Analytics/GetCustomerLicensesUsageAnalytics.cs rename to sdk/SdkSamples/Analytics/GetCustomerLicensesUsageAnalytics.cs diff --git a/Source/Partner Center SDK Samples/Analytics/GetPartnerLicensesDeploymentAnalytics.cs b/sdk/SdkSamples/Analytics/GetPartnerLicensesDeploymentAnalytics.cs similarity index 100% rename from Source/Partner Center SDK Samples/Analytics/GetPartnerLicensesDeploymentAnalytics.cs rename to sdk/SdkSamples/Analytics/GetPartnerLicensesDeploymentAnalytics.cs diff --git a/Source/Partner Center SDK Samples/Analytics/GetPartnerLicensesUsageAnalytics.cs b/sdk/SdkSamples/Analytics/GetPartnerLicensesUsageAnalytics.cs similarity index 100% rename from Source/Partner Center SDK Samples/Analytics/GetPartnerLicensesUsageAnalytics.cs rename to sdk/SdkSamples/Analytics/GetPartnerLicensesUsageAnalytics.cs diff --git a/Source/Partner Center SDK Samples/App.config b/sdk/SdkSamples/App.config similarity index 96% rename from Source/Partner Center SDK Samples/App.config rename to sdk/SdkSamples/App.config index c573633..d44f55e 100644 --- a/Source/Partner Center SDK Samples/App.config +++ b/sdk/SdkSamples/App.config @@ -8,7 +8,7 @@ - + @@ -26,9 +26,6 @@ - - - @@ -119,7 +116,7 @@ - + @@ -129,8 +126,8 @@ - + - \ No newline at end of file + diff --git a/Source/Partner Center SDK Samples/Auditing/QueryAuditRecords.cs b/sdk/SdkSamples/Auditing/QueryAuditRecords.cs similarity index 100% rename from Source/Partner Center SDK Samples/Auditing/QueryAuditRecords.cs rename to sdk/SdkSamples/Auditing/QueryAuditRecords.cs diff --git a/Source/Partner Center SDK Samples/Auditing/SearchAuditRecords.cs b/sdk/SdkSamples/Auditing/SearchAuditRecords.cs similarity index 100% rename from Source/Partner Center SDK Samples/Auditing/SearchAuditRecords.cs rename to sdk/SdkSamples/Auditing/SearchAuditRecords.cs diff --git a/Source/Partner Center SDK Samples/Auditing/SearchAuditRecordsByCustomerId.cs b/sdk/SdkSamples/Auditing/SearchAuditRecordsByCustomerId.cs similarity index 100% rename from Source/Partner Center SDK Samples/Auditing/SearchAuditRecordsByCustomerId.cs rename to sdk/SdkSamples/Auditing/SearchAuditRecordsByCustomerId.cs diff --git a/Source/Partner Center SDK Samples/Auditing/SearchAuditRecordsByResourceType.cs b/sdk/SdkSamples/Auditing/SearchAuditRecordsByResourceType.cs similarity index 100% rename from Source/Partner Center SDK Samples/Auditing/SearchAuditRecordsByResourceType.cs rename to sdk/SdkSamples/Auditing/SearchAuditRecordsByResourceType.cs diff --git a/Source/Partner Center SDK Samples/BasePartnerScenario.cs b/sdk/SdkSamples/BasePartnerScenario.cs similarity index 100% rename from Source/Partner Center SDK Samples/BasePartnerScenario.cs rename to sdk/SdkSamples/BasePartnerScenario.cs diff --git a/Source/Partner Center SDK Samples/Carts/CheckoutCart.cs b/sdk/SdkSamples/Carts/CheckoutCart.cs similarity index 100% rename from Source/Partner Center SDK Samples/Carts/CheckoutCart.cs rename to sdk/SdkSamples/Carts/CheckoutCart.cs diff --git a/Source/Partner Center SDK Samples/Carts/CreateCart.cs b/sdk/SdkSamples/Carts/CreateCart.cs similarity index 100% rename from Source/Partner Center SDK Samples/Carts/CreateCart.cs rename to sdk/SdkSamples/Carts/CreateCart.cs diff --git a/Source/Partner Center SDK Samples/Carts/CreateCartAddonWithExistingSubscription.cs b/sdk/SdkSamples/Carts/CreateCartAddonWithExistingSubscription.cs similarity index 100% rename from Source/Partner Center SDK Samples/Carts/CreateCartAddonWithExistingSubscription.cs rename to sdk/SdkSamples/Carts/CreateCartAddonWithExistingSubscription.cs diff --git a/Source/Partner Center SDK Samples/Carts/CreateCartWithAddons.cs b/sdk/SdkSamples/Carts/CreateCartWithAddons.cs similarity index 100% rename from Source/Partner Center SDK Samples/Carts/CreateCartWithAddons.cs rename to sdk/SdkSamples/Carts/CreateCartWithAddons.cs diff --git a/Source/Partner Center SDK Samples/Carts/UpdateCart.cs b/sdk/SdkSamples/Carts/UpdateCart.cs similarity index 100% rename from Source/Partner Center SDK Samples/Carts/UpdateCart.cs rename to sdk/SdkSamples/Carts/UpdateCart.cs diff --git a/Source/Partner Center SDK Samples/Configuration/ApplicationAuthenticationSection.cs b/sdk/SdkSamples/Configuration/ApplicationAuthenticationSection.cs similarity index 100% rename from Source/Partner Center SDK Samples/Configuration/ApplicationAuthenticationSection.cs rename to sdk/SdkSamples/Configuration/ApplicationAuthenticationSection.cs diff --git a/Source/Partner Center SDK Samples/Configuration/ConfigurationManager.cs b/sdk/SdkSamples/Configuration/ConfigurationManager.cs similarity index 100% rename from Source/Partner Center SDK Samples/Configuration/ConfigurationManager.cs rename to sdk/SdkSamples/Configuration/ConfigurationManager.cs diff --git a/Source/Partner Center SDK Samples/Configuration/PartnerServiceSettingsSection.cs b/sdk/SdkSamples/Configuration/PartnerServiceSettingsSection.cs similarity index 100% rename from Source/Partner Center SDK Samples/Configuration/PartnerServiceSettingsSection.cs rename to sdk/SdkSamples/Configuration/PartnerServiceSettingsSection.cs diff --git a/Source/Partner Center SDK Samples/Configuration/ScenarioSettingsSection.cs b/sdk/SdkSamples/Configuration/ScenarioSettingsSection.cs similarity index 100% rename from Source/Partner Center SDK Samples/Configuration/ScenarioSettingsSection.cs rename to sdk/SdkSamples/Configuration/ScenarioSettingsSection.cs diff --git a/Source/Partner Center SDK Samples/Configuration/Section.cs b/sdk/SdkSamples/Configuration/Section.cs similarity index 100% rename from Source/Partner Center SDK Samples/Configuration/Section.cs rename to sdk/SdkSamples/Configuration/Section.cs diff --git a/Source/Partner Center SDK Samples/Configuration/UserAuthenticationSection.cs b/sdk/SdkSamples/Configuration/UserAuthenticationSection.cs similarity index 78% rename from Source/Partner Center SDK Samples/Configuration/UserAuthenticationSection.cs rename to sdk/SdkSamples/Configuration/UserAuthenticationSection.cs index c29a076..c34e1d9 100644 --- a/Source/Partner Center SDK Samples/Configuration/UserAuthenticationSection.cs +++ b/sdk/SdkSamples/Configuration/UserAuthenticationSection.cs @@ -53,27 +53,5 @@ namespace Microsoft.Store.PartnerCenter.Samples.Configuration return new Uri(this.ConfigurationSection["RedirectUrl"]); } } - - /// - /// Gets AAD user name. - /// - public string UserName - { - get - { - return this.ConfigurationSection["UserName"]; - } - } - - /// - /// Gets AAD password. - /// - public string Password - { - get - { - return this.ConfigurationSection["Password"]; - } - } } } diff --git a/Source/Partner Center SDK Samples/Context/ScenarioContext.cs b/sdk/SdkSamples/Context/ScenarioContext.cs similarity index 75% rename from Source/Partner Center SDK Samples/Context/ScenarioContext.cs rename to sdk/SdkSamples/Context/ScenarioContext.cs index 9a5401c..4a26a96 100644 --- a/Source/Partner Center SDK Samples/Context/ScenarioContext.cs +++ b/sdk/SdkSamples/Context/ScenarioContext.cs @@ -9,21 +9,25 @@ namespace Microsoft.Store.PartnerCenter.Samples.Context using System; using System.Threading.Tasks; using Configuration; + using Extensions; using Helpers; using IdentityModel.Clients.ActiveDirectory; - using Store.PartnerCenter; - using Store.PartnerCenter.Extensions; /// /// Scenario context implementation class. /// public class ScenarioContext : IScenarioContext { + /// + /// The redirect URI used when performing app + user authentication. + /// + private static readonly Uri redirectUri = new Uri("urn:ietf:wg:oauth:2.0:oob"); + /// /// A lazy reference to an user based partner operations. /// private IAggregatePartner userPartnerOperations = null; - + /// /// A lazy reference to an application based partner operations. /// @@ -50,11 +54,11 @@ namespace Microsoft.Store.PartnerCenter.Samples.Context this.ConsoleHelper.StartProgress("Authenticating application"); IPartnerCredentials appCredentials = PartnerCredentials.Instance.GenerateByApplicationCredentials( - this.Configuration.ApplicationAuthentication.ApplicationId, - this.Configuration.ApplicationAuthentication.ApplicationSecret, - this.Configuration.ApplicationAuthentication.Domain, - this.Configuration.PartnerService.AuthenticationAuthorityEndpoint.OriginalString, - this.Configuration.PartnerService.GraphEndpoint.OriginalString); + this.Configuration.ApplicationAuthentication.ApplicationId, + this.Configuration.ApplicationAuthentication.ApplicationSecret, + this.Configuration.ApplicationAuthentication.Domain, + this.Configuration.PartnerService.AuthenticationAuthorityEndpoint.OriginalString, + this.Configuration.PartnerService.GraphEndpoint.OriginalString); this.ConsoleHelper.StopProgress(); this.ConsoleHelper.Success("Authenticated!"); @@ -69,24 +73,12 @@ namespace Microsoft.Store.PartnerCenter.Samples.Context /// /// Gets a configuration instance. /// - public ConfigurationManager Configuration - { - get - { - return ConfigurationManager.Instance; - } - } + public ConfigurationManager Configuration => ConfigurationManager.Instance; /// /// Gets a console helper instance. /// - public ConsoleHelper ConsoleHelper - { - get - { - return ConsoleHelper.Instance; - } - } + public ConsoleHelper ConsoleHelper => ConsoleHelper.Instance; /// /// Gets a partner operations instance which is user based authenticated. @@ -98,7 +90,8 @@ namespace Microsoft.Store.PartnerCenter.Samples.Context if (this.userPartnerOperations == null) { this.ConsoleHelper.StartProgress("Authenticating user"); - var aadAuthenticationResult = this.LoginUserToAad(); + + AuthenticationResult aadAuthenticationResult = this.LoginUserToAad(); // Authenticate by user context with the partner service IPartnerCredentials userCredentials = PartnerCredentials.Instance.GenerateByUserCredentials( @@ -110,7 +103,7 @@ namespace Microsoft.Store.PartnerCenter.Samples.Context { // token has expired, re-Login to Azure Active Directory this.ConsoleHelper.StartProgress("Token expired. Re-authenticating user"); - var aadToken = this.LoginUserToAad(); + AuthenticationResult aadToken = this.LoginUserToAad(); this.ConsoleHelper.StopProgress(); // give the partner SDK the new add token information @@ -133,21 +126,19 @@ namespace Microsoft.Store.PartnerCenter.Samples.Context /// The user authentication result. private AuthenticationResult LoginUserToAad() { - var addAuthority = new UriBuilder(this.Configuration.PartnerService.AuthenticationAuthorityEndpoint) + UriBuilder addAuthority = new UriBuilder(this.Configuration.PartnerService.AuthenticationAuthorityEndpoint) { Path = this.Configuration.PartnerService.CommonDomain }; - UserCredential userCredentials = new UserCredential( - this.Configuration.UserAuthentication.UserName, - this.Configuration.UserAuthentication.Password); - AuthenticationContext authContext = new AuthenticationContext(addAuthority.Uri.AbsoluteUri); - return authContext.AcquireToken( - this.Configuration.UserAuthentication.ResourceUrl.OriginalString, - this.Configuration.UserAuthentication.ApplicationId, - userCredentials); + return Task.Run(() => authContext.AcquireTokenAsync( + Configuration.UserAuthentication.ResourceUrl.OriginalString, + Configuration.UserAuthentication.ApplicationId, + redirectUri, + new PlatformParameters(PromptBehavior.Always), + UserIdentifier.AnyUser)).Result; } } } \ No newline at end of file diff --git a/Source/Partner Center SDK Samples/CustomerDirectoryRoles/AddUserMemberToDirectoryRole.cs b/sdk/SdkSamples/CustomerDirectoryRoles/AddUserMemberToDirectoryRole.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerDirectoryRoles/AddUserMemberToDirectoryRole.cs rename to sdk/SdkSamples/CustomerDirectoryRoles/AddUserMemberToDirectoryRole.cs diff --git a/Source/Partner Center SDK Samples/CustomerDirectoryRoles/GetCustomerDirectoryRoleUserMembers.cs b/sdk/SdkSamples/CustomerDirectoryRoles/GetCustomerDirectoryRoleUserMembers.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerDirectoryRoles/GetCustomerDirectoryRoleUserMembers.cs rename to sdk/SdkSamples/CustomerDirectoryRoles/GetCustomerDirectoryRoleUserMembers.cs diff --git a/Source/Partner Center SDK Samples/CustomerDirectoryRoles/GetCustomerDirectoryRoles.cs b/sdk/SdkSamples/CustomerDirectoryRoles/GetCustomerDirectoryRoles.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerDirectoryRoles/GetCustomerDirectoryRoles.cs rename to sdk/SdkSamples/CustomerDirectoryRoles/GetCustomerDirectoryRoles.cs diff --git a/Source/Partner Center SDK Samples/CustomerDirectoryRoles/RemoveCustomerUserMemberFromDirectoryRole.cs b/sdk/SdkSamples/CustomerDirectoryRoles/RemoveCustomerUserMemberFromDirectoryRole.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerDirectoryRoles/RemoveCustomerUserMemberFromDirectoryRole.cs rename to sdk/SdkSamples/CustomerDirectoryRoles/RemoveCustomerUserMemberFromDirectoryRole.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerAvailabilities.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerAvailabilities.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerAvailabilities.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerAvailabilities.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerAvailabilitiesByTargetSegment.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerAvailabilitiesByTargetSegment.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerAvailabilitiesByTargetSegment.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerAvailabilitiesByTargetSegment.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerAvailability.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerAvailability.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerAvailability.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerAvailability.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerProduct.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerProduct.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerProduct.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerProduct.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerProducts.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerProducts.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerProducts.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerProducts.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerProductsByTargetSegment.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerProductsByTargetSegment.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerProductsByTargetSegment.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerProductsByTargetSegment.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSku.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerSku.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSku.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerSku.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSkuDownloadOptions.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerSkuDownloadOptions.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSkuDownloadOptions.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerSkuDownloadOptions.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSkus.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerSkus.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSkus.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerSkus.cs diff --git a/Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSkusByTargetSegment.cs b/sdk/SdkSamples/CustomerProducts/GetCustomerSkusByTargetSegment.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerProducts/GetCustomerSkusByTargetSegment.cs rename to sdk/SdkSamples/CustomerProducts/GetCustomerSkusByTargetSegment.cs diff --git a/Source/Partner Center SDK Samples/CustomerServiceCosts/GetCustomerServiceCostsLineItems.cs b/sdk/SdkSamples/CustomerServiceCosts/GetCustomerServiceCostsLineItems.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerServiceCosts/GetCustomerServiceCostsLineItems.cs rename to sdk/SdkSamples/CustomerServiceCosts/GetCustomerServiceCostsLineItems.cs diff --git a/Source/Partner Center SDK Samples/CustomerServiceCosts/GetCustomerServiceCostsSummary.cs b/sdk/SdkSamples/CustomerServiceCosts/GetCustomerServiceCostsSummary.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerServiceCosts/GetCustomerServiceCostsSummary.cs rename to sdk/SdkSamples/CustomerServiceCosts/GetCustomerServiceCostsSummary.cs diff --git a/Source/Partner Center SDK Samples/CustomerSubscribedSkus/GetCustomerSubscribedSkus.cs b/sdk/SdkSamples/CustomerSubscribedSkus/GetCustomerSubscribedSkus.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerSubscribedSkus/GetCustomerSubscribedSkus.cs rename to sdk/SdkSamples/CustomerSubscribedSkus/GetCustomerSubscribedSkus.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CreateCustomerUser.cs b/sdk/SdkSamples/CustomerUser/CreateCustomerUser.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CreateCustomerUser.cs rename to sdk/SdkSamples/CustomerUser/CreateCustomerUser.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignGroup1Licenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignGroup1Licenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignGroup1Licenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignGroup1Licenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignGroup2Licenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignGroup2Licenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignGroup2Licenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignGroup2Licenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignLicenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignLicenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignLicenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignLicenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedGroup1AndGroup2Licenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignedGroup1AndGroup2Licenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedGroup1AndGroup2Licenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignedGroup1AndGroup2Licenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedGroup1Licenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignedGroup1Licenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedGroup1Licenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignedGroup1Licenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedGroup2Licenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignedGroup2Licenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedGroup2Licenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignedGroup2Licenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedLicenses.cs b/sdk/SdkSamples/CustomerUser/CustomerUserAssignedLicenses.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserAssignedLicenses.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserAssignedLicenses.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/CustomerUserRestore.cs b/sdk/SdkSamples/CustomerUser/CustomerUserRestore.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/CustomerUserRestore.cs rename to sdk/SdkSamples/CustomerUser/CustomerUserRestore.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/DeleteCustomerUser.cs b/sdk/SdkSamples/CustomerUser/DeleteCustomerUser.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/DeleteCustomerUser.cs rename to sdk/SdkSamples/CustomerUser/DeleteCustomerUser.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/GetCustomerInactiveUsers.cs b/sdk/SdkSamples/CustomerUser/GetCustomerInactiveUsers.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/GetCustomerInactiveUsers.cs rename to sdk/SdkSamples/CustomerUser/GetCustomerInactiveUsers.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/GetCustomerUserCollection.cs b/sdk/SdkSamples/CustomerUser/GetCustomerUserCollection.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/GetCustomerUserCollection.cs rename to sdk/SdkSamples/CustomerUser/GetCustomerUserCollection.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/GetCustomerUserDetails.cs b/sdk/SdkSamples/CustomerUser/GetCustomerUserDetails.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/GetCustomerUserDetails.cs rename to sdk/SdkSamples/CustomerUser/GetCustomerUserDetails.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/GetCustomerUserDirectoryRoles.cs b/sdk/SdkSamples/CustomerUser/GetCustomerUserDirectoryRoles.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/GetCustomerUserDirectoryRoles.cs rename to sdk/SdkSamples/CustomerUser/GetCustomerUserDirectoryRoles.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/GetPagedCustomerUsers.cs b/sdk/SdkSamples/CustomerUser/GetPagedCustomerUsers.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/GetPagedCustomerUsers.cs rename to sdk/SdkSamples/CustomerUser/GetPagedCustomerUsers.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/SortCustomerUsers.cs b/sdk/SdkSamples/CustomerUser/SortCustomerUsers.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/SortCustomerUsers.cs rename to sdk/SdkSamples/CustomerUser/SortCustomerUsers.cs diff --git a/Source/Partner Center SDK Samples/CustomerUser/UpdateCustomerUser.cs b/sdk/SdkSamples/CustomerUser/UpdateCustomerUser.cs similarity index 100% rename from Source/Partner Center SDK Samples/CustomerUser/UpdateCustomerUser.cs rename to sdk/SdkSamples/CustomerUser/UpdateCustomerUser.cs diff --git a/Source/Partner Center SDK Samples/Customers/CheckDomainAvailability.cs b/sdk/SdkSamples/Customers/CheckDomainAvailability.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/CheckDomainAvailability.cs rename to sdk/SdkSamples/Customers/CheckDomainAvailability.cs diff --git a/Source/Partner Center SDK Samples/Customers/CreateCustomer.cs b/sdk/SdkSamples/Customers/CreateCustomer.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/CreateCustomer.cs rename to sdk/SdkSamples/Customers/CreateCustomer.cs diff --git a/Source/Partner Center SDK Samples/Customers/DeleteCustomerFromTipAccount.cs b/sdk/SdkSamples/Customers/DeleteCustomerFromTipAccount.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/DeleteCustomerFromTipAccount.cs rename to sdk/SdkSamples/Customers/DeleteCustomerFromTipAccount.cs diff --git a/Source/Partner Center SDK Samples/Customers/DeletePartnerCustomerRelationship.cs b/sdk/SdkSamples/Customers/DeletePartnerCustomerRelationship.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/DeletePartnerCustomerRelationship.cs rename to sdk/SdkSamples/Customers/DeletePartnerCustomerRelationship.cs diff --git a/Source/Partner Center SDK Samples/Customers/FilterCustomers.cs b/sdk/SdkSamples/Customers/FilterCustomers.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/FilterCustomers.cs rename to sdk/SdkSamples/Customers/FilterCustomers.cs diff --git a/Source/Partner Center SDK Samples/Customers/GetCustomerDetails.cs b/sdk/SdkSamples/Customers/GetCustomerDetails.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/GetCustomerDetails.cs rename to sdk/SdkSamples/Customers/GetCustomerDetails.cs diff --git a/Source/Partner Center SDK Samples/Customers/GetCustomerManagedServices.cs b/sdk/SdkSamples/Customers/GetCustomerManagedServices.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/GetCustomerManagedServices.cs rename to sdk/SdkSamples/Customers/GetCustomerManagedServices.cs diff --git a/Source/Partner Center SDK Samples/Customers/GetCustomerQualification.cs b/sdk/SdkSamples/Customers/GetCustomerQualification.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/GetCustomerQualification.cs rename to sdk/SdkSamples/Customers/GetCustomerQualification.cs diff --git a/Source/Partner Center SDK Samples/Customers/GetCustomerRelationshipRequest.cs b/sdk/SdkSamples/Customers/GetCustomerRelationshipRequest.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/GetCustomerRelationshipRequest.cs rename to sdk/SdkSamples/Customers/GetCustomerRelationshipRequest.cs diff --git a/Source/Partner Center SDK Samples/Customers/GetPagedCustomers.cs b/sdk/SdkSamples/Customers/GetPagedCustomers.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/GetPagedCustomers.cs rename to sdk/SdkSamples/Customers/GetPagedCustomers.cs diff --git a/Source/Partner Center SDK Samples/Customers/UpdateCustomerBillingProfile.cs b/sdk/SdkSamples/Customers/UpdateCustomerBillingProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/UpdateCustomerBillingProfile.cs rename to sdk/SdkSamples/Customers/UpdateCustomerBillingProfile.cs diff --git a/Source/Partner Center SDK Samples/Customers/UpdateCustomerQualification.cs b/sdk/SdkSamples/Customers/UpdateCustomerQualification.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/UpdateCustomerQualification.cs rename to sdk/SdkSamples/Customers/UpdateCustomerQualification.cs diff --git a/Source/Partner Center SDK Samples/Customers/UpdateCustomerQualificationWithGCC.cs b/sdk/SdkSamples/Customers/UpdateCustomerQualificationWithGCC.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/UpdateCustomerQualificationWithGCC.cs rename to sdk/SdkSamples/Customers/UpdateCustomerQualificationWithGCC.cs diff --git a/Source/Partner Center SDK Samples/Customers/ValidateCustomerAddress.cs b/sdk/SdkSamples/Customers/ValidateCustomerAddress.cs similarity index 100% rename from Source/Partner Center SDK Samples/Customers/ValidateCustomerAddress.cs rename to sdk/SdkSamples/Customers/ValidateCustomerAddress.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/CreateConfigurationPolicy.cs b/sdk/SdkSamples/DevicesDeployment/CreateConfigurationPolicy.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/CreateConfigurationPolicy.cs rename to sdk/SdkSamples/DevicesDeployment/CreateConfigurationPolicy.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/CreateDeviceBatch.cs b/sdk/SdkSamples/DevicesDeployment/CreateDeviceBatch.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/CreateDeviceBatch.cs rename to sdk/SdkSamples/DevicesDeployment/CreateDeviceBatch.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/CreateDevices.cs b/sdk/SdkSamples/DevicesDeployment/CreateDevices.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/CreateDevices.cs rename to sdk/SdkSamples/DevicesDeployment/CreateDevices.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/DeleteConfigurationPolicy.cs b/sdk/SdkSamples/DevicesDeployment/DeleteConfigurationPolicy.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/DeleteConfigurationPolicy.cs rename to sdk/SdkSamples/DevicesDeployment/DeleteConfigurationPolicy.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/DeleteDevice.cs b/sdk/SdkSamples/DevicesDeployment/DeleteDevice.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/DeleteDevice.cs rename to sdk/SdkSamples/DevicesDeployment/DeleteDevice.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/GetAllConfigurationPolicies.cs b/sdk/SdkSamples/DevicesDeployment/GetAllConfigurationPolicies.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/GetAllConfigurationPolicies.cs rename to sdk/SdkSamples/DevicesDeployment/GetAllConfigurationPolicies.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/GetBatchUploadStatus.cs b/sdk/SdkSamples/DevicesDeployment/GetBatchUploadStatus.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/GetBatchUploadStatus.cs rename to sdk/SdkSamples/DevicesDeployment/GetBatchUploadStatus.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/GetDevices.cs b/sdk/SdkSamples/DevicesDeployment/GetDevices.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/GetDevices.cs rename to sdk/SdkSamples/DevicesDeployment/GetDevices.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/GetDevicesBatches.cs b/sdk/SdkSamples/DevicesDeployment/GetDevicesBatches.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/GetDevicesBatches.cs rename to sdk/SdkSamples/DevicesDeployment/GetDevicesBatches.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/UpdateConfigurationPolicy.cs b/sdk/SdkSamples/DevicesDeployment/UpdateConfigurationPolicy.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/UpdateConfigurationPolicy.cs rename to sdk/SdkSamples/DevicesDeployment/UpdateConfigurationPolicy.cs diff --git a/Source/Partner Center SDK Samples/DevicesDeployment/UpdateDevicesPolicy.cs b/sdk/SdkSamples/DevicesDeployment/UpdateDevicesPolicy.cs similarity index 100% rename from Source/Partner Center SDK Samples/DevicesDeployment/UpdateDevicesPolicy.cs rename to sdk/SdkSamples/DevicesDeployment/UpdateDevicesPolicy.cs diff --git a/Source/Partner Center SDK Samples/Entitlements/GetEntitlements.cs b/sdk/SdkSamples/Entitlements/GetEntitlements.cs similarity index 100% rename from Source/Partner Center SDK Samples/Entitlements/GetEntitlements.cs rename to sdk/SdkSamples/Entitlements/GetEntitlements.cs diff --git a/Source/Partner Center SDK Samples/Helpers/ConsoleHelper.cs b/sdk/SdkSamples/Helpers/ConsoleHelper.cs similarity index 100% rename from Source/Partner Center SDK Samples/Helpers/ConsoleHelper.cs rename to sdk/SdkSamples/Helpers/ConsoleHelper.cs diff --git a/Source/Partner Center SDK Samples/IPartnerScenario.cs b/sdk/SdkSamples/IPartnerScenario.cs similarity index 100% rename from Source/Partner Center SDK Samples/IPartnerScenario.cs rename to sdk/SdkSamples/IPartnerScenario.cs diff --git a/Source/Partner Center SDK Samples/IScenarioContext.cs b/sdk/SdkSamples/IScenarioContext.cs similarity index 100% rename from Source/Partner Center SDK Samples/IScenarioContext.cs rename to sdk/SdkSamples/IScenarioContext.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/CreateCustomerForIndirectReseller.cs b/sdk/SdkSamples/IndirectModel/CreateCustomerForIndirectReseller.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/CreateCustomerForIndirectReseller.cs rename to sdk/SdkSamples/IndirectModel/CreateCustomerForIndirectReseller.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/GetCustomersOfIndirectReseller.cs b/sdk/SdkSamples/IndirectModel/GetCustomersOfIndirectReseller.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/GetCustomersOfIndirectReseller.cs rename to sdk/SdkSamples/IndirectModel/GetCustomersOfIndirectReseller.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/GetIndirectResellers.cs b/sdk/SdkSamples/IndirectModel/GetIndirectResellers.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/GetIndirectResellers.cs rename to sdk/SdkSamples/IndirectModel/GetIndirectResellers.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/GetIndirectResellersOfCustomer.cs b/sdk/SdkSamples/IndirectModel/GetIndirectResellersOfCustomer.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/GetIndirectResellersOfCustomer.cs rename to sdk/SdkSamples/IndirectModel/GetIndirectResellersOfCustomer.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/GetSubscriptionsByMpnId.cs b/sdk/SdkSamples/IndirectModel/GetSubscriptionsByMpnId.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/GetSubscriptionsByMpnId.cs rename to sdk/SdkSamples/IndirectModel/GetSubscriptionsByMpnId.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/PlaceOrderForCustomer.cs b/sdk/SdkSamples/IndirectModel/PlaceOrderForCustomer.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/PlaceOrderForCustomer.cs rename to sdk/SdkSamples/IndirectModel/PlaceOrderForCustomer.cs diff --git a/Source/Partner Center SDK Samples/IndirectModel/VerifyPartnerMpnId.cs b/sdk/SdkSamples/IndirectModel/VerifyPartnerMpnId.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectModel/VerifyPartnerMpnId.cs rename to sdk/SdkSamples/IndirectModel/VerifyPartnerMpnId.cs diff --git a/Source/Partner Center SDK Samples/IndirectPartners/GetSubscriptionsByMpnId.cs b/sdk/SdkSamples/IndirectPartners/GetSubscriptionsByMpnId.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectPartners/GetSubscriptionsByMpnId.cs rename to sdk/SdkSamples/IndirectPartners/GetSubscriptionsByMpnId.cs diff --git a/Source/Partner Center SDK Samples/IndirectPartners/VerifyPartnerMpnId.cs b/sdk/SdkSamples/IndirectPartners/VerifyPartnerMpnId.cs similarity index 100% rename from Source/Partner Center SDK Samples/IndirectPartners/VerifyPartnerMpnId.cs rename to sdk/SdkSamples/IndirectPartners/VerifyPartnerMpnId.cs diff --git a/Source/Partner Center SDK Samples/Invoice/GetAccountBalance.cs b/sdk/SdkSamples/Invoice/GetAccountBalance.cs similarity index 100% rename from Source/Partner Center SDK Samples/Invoice/GetAccountBalance.cs rename to sdk/SdkSamples/Invoice/GetAccountBalance.cs diff --git a/Source/Partner Center SDK Samples/Invoice/GetInvoice.cs b/sdk/SdkSamples/Invoice/GetInvoice.cs similarity index 100% rename from Source/Partner Center SDK Samples/Invoice/GetInvoice.cs rename to sdk/SdkSamples/Invoice/GetInvoice.cs diff --git a/Source/Partner Center SDK Samples/Invoice/GetInvoiceLineItems.cs b/sdk/SdkSamples/Invoice/GetInvoiceLineItems.cs similarity index 100% rename from Source/Partner Center SDK Samples/Invoice/GetInvoiceLineItems.cs rename to sdk/SdkSamples/Invoice/GetInvoiceLineItems.cs diff --git a/Source/Partner Center SDK Samples/Invoice/GetInvoiceStatement.cs b/sdk/SdkSamples/Invoice/GetInvoiceStatement.cs similarity index 100% rename from Source/Partner Center SDK Samples/Invoice/GetInvoiceStatement.cs rename to sdk/SdkSamples/Invoice/GetInvoiceStatement.cs diff --git a/Source/Partner Center SDK Samples/Invoice/GetInvoiceSummaries.cs b/sdk/SdkSamples/Invoice/GetInvoiceSummaries.cs similarity index 100% rename from Source/Partner Center SDK Samples/Invoice/GetInvoiceSummaries.cs rename to sdk/SdkSamples/Invoice/GetInvoiceSummaries.cs diff --git a/Source/Partner Center SDK Samples/Invoice/GetPagedInvoices.cs b/sdk/SdkSamples/Invoice/GetPagedInvoices.cs similarity index 100% rename from Source/Partner Center SDK Samples/Invoice/GetPagedInvoices.cs rename to sdk/SdkSamples/Invoice/GetPagedInvoices.cs diff --git a/Source/Partner Center SDK Samples/Offers/GetCustomerOfferCategories.cs b/sdk/SdkSamples/Offers/GetCustomerOfferCategories.cs similarity index 100% rename from Source/Partner Center SDK Samples/Offers/GetCustomerOfferCategories.cs rename to sdk/SdkSamples/Offers/GetCustomerOfferCategories.cs diff --git a/Source/Partner Center SDK Samples/Offers/GetCustomerOffers.cs b/sdk/SdkSamples/Offers/GetCustomerOffers.cs similarity index 100% rename from Source/Partner Center SDK Samples/Offers/GetCustomerOffers.cs rename to sdk/SdkSamples/Offers/GetCustomerOffers.cs diff --git a/Source/Partner Center SDK Samples/Offers/GetOffer.cs b/sdk/SdkSamples/Offers/GetOffer.cs similarity index 100% rename from Source/Partner Center SDK Samples/Offers/GetOffer.cs rename to sdk/SdkSamples/Offers/GetOffer.cs diff --git a/Source/Partner Center SDK Samples/Offers/GetOfferCategories.cs b/sdk/SdkSamples/Offers/GetOfferCategories.cs similarity index 100% rename from Source/Partner Center SDK Samples/Offers/GetOfferCategories.cs rename to sdk/SdkSamples/Offers/GetOfferCategories.cs diff --git a/Source/Partner Center SDK Samples/Offers/GetOffers.cs b/sdk/SdkSamples/Offers/GetOffers.cs similarity index 100% rename from Source/Partner Center SDK Samples/Offers/GetOffers.cs rename to sdk/SdkSamples/Offers/GetOffers.cs diff --git a/Source/Partner Center SDK Samples/Offers/GetPagedOffers.cs b/sdk/SdkSamples/Offers/GetPagedOffers.cs similarity index 100% rename from Source/Partner Center SDK Samples/Offers/GetPagedOffers.cs rename to sdk/SdkSamples/Offers/GetPagedOffers.cs diff --git a/Source/Partner Center SDK Samples/Orders/CreateAzureReservationOrder.cs b/sdk/SdkSamples/Orders/CreateAzureReservationOrder.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/CreateAzureReservationOrder.cs rename to sdk/SdkSamples/Orders/CreateAzureReservationOrder.cs diff --git a/Source/Partner Center SDK Samples/Orders/CreateOrder.cs b/sdk/SdkSamples/Orders/CreateOrder.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/CreateOrder.cs rename to sdk/SdkSamples/Orders/CreateOrder.cs diff --git a/Source/Partner Center SDK Samples/Orders/GetOrderDetails.cs b/sdk/SdkSamples/Orders/GetOrderDetails.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/GetOrderDetails.cs rename to sdk/SdkSamples/Orders/GetOrderDetails.cs diff --git a/Source/Partner Center SDK Samples/Orders/GetOrderProvisioningStatus.cs b/sdk/SdkSamples/Orders/GetOrderProvisioningStatus.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/GetOrderProvisioningStatus.cs rename to sdk/SdkSamples/Orders/GetOrderProvisioningStatus.cs diff --git a/Source/Partner Center SDK Samples/Orders/GetOrders.cs b/sdk/SdkSamples/Orders/GetOrders.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/GetOrders.cs rename to sdk/SdkSamples/Orders/GetOrders.cs diff --git a/Source/Partner Center SDK Samples/Orders/GetOrdersByBillingCycleType.cs b/sdk/SdkSamples/Orders/GetOrdersByBillingCycleType.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/GetOrdersByBillingCycleType.cs rename to sdk/SdkSamples/Orders/GetOrdersByBillingCycleType.cs diff --git a/Source/Partner Center SDK Samples/Orders/UpdateOrder.cs b/sdk/SdkSamples/Orders/UpdateOrder.cs similarity index 100% rename from Source/Partner Center SDK Samples/Orders/UpdateOrder.cs rename to sdk/SdkSamples/Orders/UpdateOrder.cs diff --git a/Source/Partner Center SDK Samples/Products/CheckInventory.cs b/sdk/SdkSamples/Products/CheckInventory.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/CheckInventory.cs rename to sdk/SdkSamples/Products/CheckInventory.cs diff --git a/Source/Partner Center SDK Samples/Products/GetAvailabilities.cs b/sdk/SdkSamples/Products/GetAvailabilities.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetAvailabilities.cs rename to sdk/SdkSamples/Products/GetAvailabilities.cs diff --git a/Source/Partner Center SDK Samples/Products/GetAvailabilitiesByTargetSegment.cs b/sdk/SdkSamples/Products/GetAvailabilitiesByTargetSegment.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetAvailabilitiesByTargetSegment.cs rename to sdk/SdkSamples/Products/GetAvailabilitiesByTargetSegment.cs diff --git a/Source/Partner Center SDK Samples/Products/GetAvailability.cs b/sdk/SdkSamples/Products/GetAvailability.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetAvailability.cs rename to sdk/SdkSamples/Products/GetAvailability.cs diff --git a/Source/Partner Center SDK Samples/Products/GetProduct.cs b/sdk/SdkSamples/Products/GetProduct.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetProduct.cs rename to sdk/SdkSamples/Products/GetProduct.cs diff --git a/Source/Partner Center SDK Samples/Products/GetProducts.cs b/sdk/SdkSamples/Products/GetProducts.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetProducts.cs rename to sdk/SdkSamples/Products/GetProducts.cs diff --git a/Source/Partner Center SDK Samples/Products/GetProductsByTargetSegment.cs b/sdk/SdkSamples/Products/GetProductsByTargetSegment.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetProductsByTargetSegment.cs rename to sdk/SdkSamples/Products/GetProductsByTargetSegment.cs diff --git a/Source/Partner Center SDK Samples/Products/GetSku.cs b/sdk/SdkSamples/Products/GetSku.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetSku.cs rename to sdk/SdkSamples/Products/GetSku.cs diff --git a/Source/Partner Center SDK Samples/Products/GetSkuDownloadOptions.cs b/sdk/SdkSamples/Products/GetSkuDownloadOptions.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetSkuDownloadOptions.cs rename to sdk/SdkSamples/Products/GetSkuDownloadOptions.cs diff --git a/Source/Partner Center SDK Samples/Products/GetSkus.cs b/sdk/SdkSamples/Products/GetSkus.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetSkus.cs rename to sdk/SdkSamples/Products/GetSkus.cs diff --git a/Source/Partner Center SDK Samples/Products/GetSkusByTargetSegment.cs b/sdk/SdkSamples/Products/GetSkusByTargetSegment.cs similarity index 100% rename from Source/Partner Center SDK Samples/Products/GetSkusByTargetSegment.cs rename to sdk/SdkSamples/Products/GetSkusByTargetSegment.cs diff --git a/Source/Partner Center SDK Samples/Profile/GetBillingProfile.cs b/sdk/SdkSamples/Profile/GetBillingProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/GetBillingProfile.cs rename to sdk/SdkSamples/Profile/GetBillingProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/GetMPNProfile.cs b/sdk/SdkSamples/Profile/GetMPNProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/GetMPNProfile.cs rename to sdk/SdkSamples/Profile/GetMPNProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/GetOrganizationProfile.cs b/sdk/SdkSamples/Profile/GetOrganizationProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/GetOrganizationProfile.cs rename to sdk/SdkSamples/Profile/GetOrganizationProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/GetSupportProfile.cs b/sdk/SdkSamples/Profile/GetSupportProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/GetSupportProfile.cs rename to sdk/SdkSamples/Profile/GetSupportProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/GetlegalBusinessProfile.cs b/sdk/SdkSamples/Profile/GetlegalBusinessProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/GetlegalBusinessProfile.cs rename to sdk/SdkSamples/Profile/GetlegalBusinessProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/UpdateBillingProfile.cs b/sdk/SdkSamples/Profile/UpdateBillingProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/UpdateBillingProfile.cs rename to sdk/SdkSamples/Profile/UpdateBillingProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/UpdateLegalBusinessProfile.cs b/sdk/SdkSamples/Profile/UpdateLegalBusinessProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/UpdateLegalBusinessProfile.cs rename to sdk/SdkSamples/Profile/UpdateLegalBusinessProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/UpdateOrganizationProfile.cs b/sdk/SdkSamples/Profile/UpdateOrganizationProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/UpdateOrganizationProfile.cs rename to sdk/SdkSamples/Profile/UpdateOrganizationProfile.cs diff --git a/Source/Partner Center SDK Samples/Profile/UpdateSupportProfile.cs b/sdk/SdkSamples/Profile/UpdateSupportProfile.cs similarity index 100% rename from Source/Partner Center SDK Samples/Profile/UpdateSupportProfile.cs rename to sdk/SdkSamples/Profile/UpdateSupportProfile.cs diff --git a/Source/Partner Center SDK Samples/Program.cs b/sdk/SdkSamples/Program.cs similarity index 100% rename from Source/Partner Center SDK Samples/Program.cs rename to sdk/SdkSamples/Program.cs diff --git a/Source/Partner Center SDK Samples/Properties/AssemblyInfo.cs b/sdk/SdkSamples/Properties/AssemblyInfo.cs similarity index 100% rename from Source/Partner Center SDK Samples/Properties/AssemblyInfo.cs rename to sdk/SdkSamples/Properties/AssemblyInfo.cs diff --git a/Source/Partner Center SDK Samples/RateCards/GetAzureRateCard.cs b/sdk/SdkSamples/RateCards/GetAzureRateCard.cs similarity index 100% rename from Source/Partner Center SDK Samples/RateCards/GetAzureRateCard.cs rename to sdk/SdkSamples/RateCards/GetAzureRateCard.cs diff --git a/Source/Partner Center SDK Samples/RateCards/GetAzureSharedRateCard.cs b/sdk/SdkSamples/RateCards/GetAzureSharedRateCard.cs similarity index 100% rename from Source/Partner Center SDK Samples/RateCards/GetAzureSharedRateCard.cs rename to sdk/SdkSamples/RateCards/GetAzureSharedRateCard.cs diff --git a/Source/Partner Center SDK Samples/RatedUsage/GetCustomerSubscriptionsUsage.cs b/sdk/SdkSamples/RatedUsage/GetCustomerSubscriptionsUsage.cs similarity index 100% rename from Source/Partner Center SDK Samples/RatedUsage/GetCustomerSubscriptionsUsage.cs rename to sdk/SdkSamples/RatedUsage/GetCustomerSubscriptionsUsage.cs diff --git a/Source/Partner Center SDK Samples/RatedUsage/GetCustomerUsageSummary.cs b/sdk/SdkSamples/RatedUsage/GetCustomerUsageSummary.cs similarity index 100% rename from Source/Partner Center SDK Samples/RatedUsage/GetCustomerUsageSummary.cs rename to sdk/SdkSamples/RatedUsage/GetCustomerUsageSummary.cs diff --git a/Source/Partner Center SDK Samples/RatedUsage/GetSubscriptionResourceUsage.cs b/sdk/SdkSamples/RatedUsage/GetSubscriptionResourceUsage.cs similarity index 100% rename from Source/Partner Center SDK Samples/RatedUsage/GetSubscriptionResourceUsage.cs rename to sdk/SdkSamples/RatedUsage/GetSubscriptionResourceUsage.cs diff --git a/Source/Partner Center SDK Samples/RatedUsage/GetSubscriptionUsageRecords.cs b/sdk/SdkSamples/RatedUsage/GetSubscriptionUsageRecords.cs similarity index 100% rename from Source/Partner Center SDK Samples/RatedUsage/GetSubscriptionUsageRecords.cs rename to sdk/SdkSamples/RatedUsage/GetSubscriptionUsageRecords.cs diff --git a/Source/Partner Center SDK Samples/RatedUsage/GetSubscriptionUsageSummary.cs b/sdk/SdkSamples/RatedUsage/GetSubscriptionUsageSummary.cs similarity index 100% rename from Source/Partner Center SDK Samples/RatedUsage/GetSubscriptionUsageSummary.cs rename to sdk/SdkSamples/RatedUsage/GetSubscriptionUsageSummary.cs diff --git a/Source/Partner Center SDK Samples/ScenarioExecution/AggregateScenarioExecutionStrategy.cs b/sdk/SdkSamples/ScenarioExecution/AggregateScenarioExecutionStrategy.cs similarity index 100% rename from Source/Partner Center SDK Samples/ScenarioExecution/AggregateScenarioExecutionStrategy.cs rename to sdk/SdkSamples/ScenarioExecution/AggregateScenarioExecutionStrategy.cs diff --git a/Source/Partner Center SDK Samples/ScenarioExecution/IScenarioExecutionStrategy.cs b/sdk/SdkSamples/ScenarioExecution/IScenarioExecutionStrategy.cs similarity index 100% rename from Source/Partner Center SDK Samples/ScenarioExecution/IScenarioExecutionStrategy.cs rename to sdk/SdkSamples/ScenarioExecution/IScenarioExecutionStrategy.cs diff --git a/Source/Partner Center SDK Samples/ScenarioExecution/PromptExecutionStrategy.cs b/sdk/SdkSamples/ScenarioExecution/PromptExecutionStrategy.cs similarity index 100% rename from Source/Partner Center SDK Samples/ScenarioExecution/PromptExecutionStrategy.cs rename to sdk/SdkSamples/ScenarioExecution/PromptExecutionStrategy.cs diff --git a/Source/Partner Center SDK Samples/Partner Center SDK Samples.csproj b/sdk/SdkSamples/SdkSamples.csproj similarity index 84% rename from Source/Partner Center SDK Samples/Partner Center SDK Samples.csproj rename to sdk/SdkSamples/SdkSamples.csproj index 97a8649..e06ad6f 100644 --- a/Source/Partner Center SDK Samples/Partner Center SDK Samples.csproj +++ b/sdk/SdkSamples/SdkSamples.csproj @@ -9,7 +9,7 @@ Properties Microsoft.Store.PartnerCenter.Samples Microsoft.Store.PartnerCenter.Samples - v4.5.1 + v4.6.1 512 true @@ -25,9 +25,10 @@ DEBUG;TRACE prompt 4 - true + false bin\Debug\Microsoft.Store.PartnerCenter.Samples.xml true + false AnyCPU @@ -41,28 +42,27 @@ bin\Release\Microsoft.Store.PartnerCenter.Samples.xml - - ..\..\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.IdentityModel.Clients.ActiveDirectory.4.4.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - ..\..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.dll + ..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.dll - ..\..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Extensions.dll + ..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Extensions.dll - ..\..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Models.dll + ..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Models.dll - ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll + + + @@ -243,25 +243,8 @@ Designer - - Designer - - + - - - - 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/Source/Partner Center SDK Samples/ServiceIncidents/GetServiceIncidents.cs b/sdk/SdkSamples/ServiceIncidents/GetServiceIncidents.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceIncidents/GetServiceIncidents.cs rename to sdk/SdkSamples/ServiceIncidents/GetServiceIncidents.cs diff --git a/Source/Partner Center SDK Samples/ServiceRequests/CreatePartnerServiceRequest.cs b/sdk/SdkSamples/ServiceRequests/CreatePartnerServiceRequest.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceRequests/CreatePartnerServiceRequest.cs rename to sdk/SdkSamples/ServiceRequests/CreatePartnerServiceRequest.cs diff --git a/Source/Partner Center SDK Samples/ServiceRequests/GetCustomerServiceRequests.cs b/sdk/SdkSamples/ServiceRequests/GetCustomerServiceRequests.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceRequests/GetCustomerServiceRequests.cs rename to sdk/SdkSamples/ServiceRequests/GetCustomerServiceRequests.cs diff --git a/Source/Partner Center SDK Samples/ServiceRequests/GetPagedPartnerServiceRequests.cs b/sdk/SdkSamples/ServiceRequests/GetPagedPartnerServiceRequests.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceRequests/GetPagedPartnerServiceRequests.cs rename to sdk/SdkSamples/ServiceRequests/GetPagedPartnerServiceRequests.cs diff --git a/Source/Partner Center SDK Samples/ServiceRequests/GetPartnerServiceRequestDetails.cs b/sdk/SdkSamples/ServiceRequests/GetPartnerServiceRequestDetails.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceRequests/GetPartnerServiceRequestDetails.cs rename to sdk/SdkSamples/ServiceRequests/GetPartnerServiceRequestDetails.cs diff --git a/Source/Partner Center SDK Samples/ServiceRequests/GetServiceRequestSupportTopics.cs b/sdk/SdkSamples/ServiceRequests/GetServiceRequestSupportTopics.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceRequests/GetServiceRequestSupportTopics.cs rename to sdk/SdkSamples/ServiceRequests/GetServiceRequestSupportTopics.cs diff --git a/Source/Partner Center SDK Samples/ServiceRequests/UpdatePartnerServiceRequest.cs b/sdk/SdkSamples/ServiceRequests/UpdatePartnerServiceRequest.cs similarity index 100% rename from Source/Partner Center SDK Samples/ServiceRequests/UpdatePartnerServiceRequest.cs rename to sdk/SdkSamples/ServiceRequests/UpdatePartnerServiceRequest.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/AddSubscriptionAddOn.cs b/sdk/SdkSamples/Subscriptions/AddSubscriptionAddOn.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/AddSubscriptionAddOn.cs rename to sdk/SdkSamples/Subscriptions/AddSubscriptionAddOn.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/ConvertTrialSubscription.cs b/sdk/SdkSamples/Subscriptions/ConvertTrialSubscription.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/ConvertTrialSubscription.cs rename to sdk/SdkSamples/Subscriptions/ConvertTrialSubscription.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/GetSubscription.cs b/sdk/SdkSamples/Subscriptions/GetSubscription.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/GetSubscription.cs rename to sdk/SdkSamples/Subscriptions/GetSubscription.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/GetSubscriptionProvisioningStatus.cs b/sdk/SdkSamples/Subscriptions/GetSubscriptionProvisioningStatus.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/GetSubscriptionProvisioningStatus.cs rename to sdk/SdkSamples/Subscriptions/GetSubscriptionProvisioningStatus.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/GetSubscriptionSupportContact.cs b/sdk/SdkSamples/Subscriptions/GetSubscriptionSupportContact.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/GetSubscriptionSupportContact.cs rename to sdk/SdkSamples/Subscriptions/GetSubscriptionSupportContact.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/GetSubscriptions.cs b/sdk/SdkSamples/Subscriptions/GetSubscriptions.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/GetSubscriptions.cs rename to sdk/SdkSamples/Subscriptions/GetSubscriptions.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/GetSubscriptionsByOrder.cs b/sdk/SdkSamples/Subscriptions/GetSubscriptionsByOrder.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/GetSubscriptionsByOrder.cs rename to sdk/SdkSamples/Subscriptions/GetSubscriptionsByOrder.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/UpdateSubscription.cs b/sdk/SdkSamples/Subscriptions/UpdateSubscription.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/UpdateSubscription.cs rename to sdk/SdkSamples/Subscriptions/UpdateSubscription.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/UpdateSubscriptionSupportContact.cs b/sdk/SdkSamples/Subscriptions/UpdateSubscriptionSupportContact.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/UpdateSubscriptionSupportContact.cs rename to sdk/SdkSamples/Subscriptions/UpdateSubscriptionSupportContact.cs diff --git a/Source/Partner Center SDK Samples/Subscriptions/UpgradeSubscription.cs b/sdk/SdkSamples/Subscriptions/UpgradeSubscription.cs similarity index 100% rename from Source/Partner Center SDK Samples/Subscriptions/UpgradeSubscription.cs rename to sdk/SdkSamples/Subscriptions/UpgradeSubscription.cs diff --git a/Source/Partner Center SDK Samples/Utilization/GetAzureSubscriptionUtilization.cs b/sdk/SdkSamples/Utilization/GetAzureSubscriptionUtilization.cs similarity index 100% rename from Source/Partner Center SDK Samples/Utilization/GetAzureSubscriptionUtilization.cs rename to sdk/SdkSamples/Utilization/GetAzureSubscriptionUtilization.cs diff --git a/Source/Partner Center SDK Samples/Validations/AddressValidation.cs b/sdk/SdkSamples/Validations/AddressValidation.cs similarity index 100% rename from Source/Partner Center SDK Samples/Validations/AddressValidation.cs rename to sdk/SdkSamples/Validations/AddressValidation.cs diff --git a/Source/Partner Center SDK Samples/Validations/ValidateAddress.cs b/sdk/SdkSamples/Validations/ValidateAddress.cs similarity index 100% rename from Source/Partner Center SDK Samples/Validations/ValidateAddress.cs rename to sdk/SdkSamples/Validations/ValidateAddress.cs diff --git a/Source/Partner Center SDK Samples/packages.config b/sdk/SdkSamples/packages.config similarity index 57% rename from Source/Partner Center SDK Samples/packages.config rename to sdk/SdkSamples/packages.config index 64ae55c..ccf8ec4 100644 --- a/Source/Partner Center SDK Samples/packages.config +++ b/sdk/SdkSamples/packages.config @@ -1,7 +1,6 @@  - - - - + + + \ No newline at end of file diff --git a/secure-app-model/README.md b/secure-app-model/README.md new file mode 100644 index 0000000..e52e17a --- /dev/null +++ b/secure-app-model/README.md @@ -0,0 +1,5 @@ +# Secure App Model + +## Overview + +Microsoft is introducing a secure, scalable framework for authenticating Cloud Solution Provider (CSP) and Control Panel Vendors (CPV) using multi-factor authentication (MFA). This new model will elevate security for operations involving the Partner Center API. This will help all parties including Microsoft and partners to protect their infrastructure and customer data from security risk. \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication.sln b/secure-app-model/keyvault/CPVApplication.sln new file mode 100644 index 0000000..1cacae0 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPVApplication", "CPVApplication\CPVApplication.csproj", "{9283AF7A-6CA9-4373-93CB-F5D2130E1889}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3CBE281A-E046-480F-8FC6-34536B951BEC} + EndGlobalSection +EndGlobal diff --git a/secure-app-model/keyvault/CPVApplication/App.config b/secure-app-model/keyvault/CPVApplication/App.config new file mode 100644 index 0000000..685ab40 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/App.config @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication/CPVApplication.csproj b/secure-app-model/keyvault/CPVApplication/CPVApplication.csproj new file mode 100644 index 0000000..22ccb8b --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/CPVApplication.csproj @@ -0,0 +1,111 @@ + + + + + Debug + AnyCPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889} + Exe + CPVApplication + CPVApplication + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\Microsoft.Azure.KeyVault.3.0.2\lib\net452\Microsoft.Azure.KeyVault.dll + + + packages\Microsoft.Azure.KeyVault.WebKey.3.0.2\lib\net452\Microsoft.Azure.KeyVault.WebKey.dll + + + packages\Microsoft.IdentityModel.Clients.ActiveDirectory.4.4.1\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + packages\Microsoft.Rest.ClientRuntime.2.3.18\lib\net452\Microsoft.Rest.ClientRuntime.dll + + + packages\Microsoft.Rest.ClientRuntime.Azure.3.3.18\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll + + + packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.dll + + + packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Extensions.dll + + + packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Models.dll + + + packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + + + + + + + packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll + + + packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + + + packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + + + packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll + + + + + + + + + + + + + + + + + + + Designer + + + Designer + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication/CPVApplication.sln b/secure-app-model/keyvault/CPVApplication/CPVApplication.sln new file mode 100644 index 0000000..0c79432 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/CPVApplication.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CPVApplication", "CPVApplication.csproj", "{9283AF7A-6CA9-4373-93CB-F5D2130E1889}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3A06FFB3-C870-4EE7-A03D-0ECB09F84BB6} + EndGlobalSection +EndGlobal diff --git a/secure-app-model/keyvault/CPVApplication/Program.cs b/secure-app-model/keyvault/CPVApplication/Program.cs new file mode 100644 index 0000000..83b1a26 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/Program.cs @@ -0,0 +1,185 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CPVApplication +{ + using System; + using System.Configuration; + using System.Threading.Tasks; + using CPVApplication.Utilities; + using Microsoft.Store.PartnerCenter; + using Microsoft.Store.PartnerCenter.Extensions; + using Microsoft.Store.PartnerCenter.Models; + using Microsoft.Store.PartnerCenter.Models.Users; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + internal class Program + { + /// + /// The following code assumes that the context of the partner is pre determined by some external code + /// (based on marketplace application logic: either by product or by partner context) + /// + + private static readonly string CPVApplicationId = ConfigurationManager.AppSettings["ida:CPVApplicationId"]; + private static readonly string CPVApplicationSecret = ConfigurationManager.AppSettings["ida:CPVApplicationSecret"]; + + private static void Main(string[] args) + { + Task.Run(() => Run()).Wait(); + } + + private static async Task Run() + { + // The following properties indicate which partner and customer context the calls are going to be made. + string PartnerId = ""; + string CustomerId = ""; + + Console.WriteLine(" ===================== Partner center API calls ============================", DateTime.Now); + IAggregatePartner ops = await GetUserPartnerOperationsAsync(PartnerId); + SeekBasedResourceCollection customerUsers = ops.Customers.ById(CustomerId).Users.Get(); + Console.WriteLine(JsonConvert.SerializeObject(customerUsers)); + + Console.WriteLine(" ===================== Partner graph API calls ============================", DateTime.Now); + Tuple tokenResult = await LoginToGraph(PartnerId); + JObject mydetails = await ApiCalls.GetAsync(tokenResult.Item1, "https://graph.microsoft.com/v1.0/me"); + Console.WriteLine(JsonConvert.SerializeObject(mydetails)); + + // The customer graph calls require customer admin to consent the application + Console.WriteLine(" ===================== Customer consent for graph API calls ============================", DateTime.Now); + + // Enable consent + Tuple tokenPartnerResult = await LoginToPartnerCenter(PartnerId); + JObject contents = new JObject + { + // Provide your application display name + ["displayName"] = "CPV Marketplace", + + // Provide your application id + ["applicationId"] = CPVApplicationId, + + // Provide your application grants + ["applicationGrants"] = new JArray( + JObject.Parse("{\"enterpriseApplicationId\": \"00000002-0000-0000-c000-000000000000\", \"scope\":\"Domain.ReadWrite.All,User.ReadWrite.All,Directory.Read.All\"}"), // for graph api access, Directory.Read.All + JObject.Parse("{\"enterpriseApplicationId\": \"797f4846-ba00-4fd7-ba43-dac1f8f63013\", \"scope\":\"user_impersonation\"}")) // for ARM api access + }; + + /** The following steps have to performed once in per customer tenant if your application is Control panel vendor application and requires customer tenant graph access **/ + + // delete the previous grant into customer tenant + JObject consentDeletion = await ApiCalls.DeleteAsync( + tokenPartnerResult.Item1, + string.Format("https://api.partnercenter.microsoft.com/v1/customers/{0}/applicationconsents/{1}", CustomerId, CPVApplicationId)); + Console.WriteLine(JsonConvert.SerializeObject(consentDeletion)); + + // create new grants for the application given the setting in application grants payload. + JObject consentCreation = await ApiCalls.PostAsync( + tokenPartnerResult.Item1, + string.Format("https://api.partnercenter.microsoft.com/v1/customers/{0}/applicationconsents", CustomerId), + contents.ToString()); + Console.WriteLine(JsonConvert.SerializeObject(consentCreation)); + + + Console.WriteLine(" ===================== Customer graph API calls ============================", DateTime.Now); + + Tuple tokenCustomerResult = await LoginToCustomerGraph(PartnerId, CustomerId); + JObject customerDomainsUsingGraph = await ApiCalls.GetAsync(tokenCustomerResult.Item1, "https://graph.windows.net/" + CustomerId + "/domains?api-version=1.6"); + Console.WriteLine(JsonConvert.SerializeObject(customerDomainsUsingGraph)); + + Console.ReadLine(); + } + + public static async Task> LoginToPartnerCenter(string tenantId) + { + KeyVaultProvider provider = new KeyVaultProvider(); + string refreshToken = await provider.GetSecretAsync(tenantId); + + JObject token = await AuthorizationUtilities.GetAADTokenFromRefreshToken( + "https://login.microsoftonline.com/" + tenantId, + "https://api.partnercenter.microsoft.com", + CPVApplicationId, + CPVApplicationSecret, + refreshToken); + + return new Tuple(token["access_token"].ToString(), DateTimeOffset.UtcNow + TimeSpan.FromTicks(long.Parse(token["expires_on"].ToString()))); + } + + /// + /// Generates a token for Partner tenant using partner user refresh token + /// The expiry time calculation explined below is not strong. + /// please use stardard ADAL library to gain access token by refresh token, which provides strongly typed classes with proper expirty time calculation. + /// + /// partner tenant id + /// + /// Access token and expiry time. + /// + public static async Task> LoginToGraph(string partnerTenantId) + { + KeyVaultProvider provider = new KeyVaultProvider(); + string refreshToken = await provider.GetSecretAsync(partnerTenantId); + + JObject token = await AuthorizationUtilities.GetAADTokenFromRefreshToken( + "https://login.microsoftonline.com/" + partnerTenantId, + "https://graph.microsoft.com", + CPVApplicationId, + CPVApplicationSecret, + refreshToken); + + return new Tuple(token["access_token"].ToString(), DateTimeOffset.UtcNow + TimeSpan.FromTicks(long.Parse(token["expires_on"].ToString()))); + } + + /// + /// Generates a token for Customer tenant using partner user refresh token + /// The expiry time calculation explined below is not strong. + /// please use stardard ADAL library to gain access token by refresh token, which provides strongly typed classes with proper expirty time calculation. + /// + /// partner tenant id + /// customer tenant id + /// + /// Access token and expiry time. + /// + public static async Task> LoginToCustomerGraph(string partnerTenantId, string customerTenantId) + { + KeyVaultProvider provider = new KeyVaultProvider(); + string refreshToken = await provider.GetSecretAsync(partnerTenantId); + + JObject token = await AuthorizationUtilities.GetAADTokenFromRefreshToken( + "https://login.microsoftonline.com/" + customerTenantId, + "https://graph.windows.net", + CPVApplicationId, + CPVApplicationSecret, + refreshToken); + + return new Tuple(token["access_token"].ToString(), DateTimeOffset.UtcNow + TimeSpan.FromTicks(long.Parse(token["expires_on"].ToString()))); + } + + /// + /// Using Partner center .NET SDK to make partner center calls. If you are using java application, you can either us REST calls or use Java SDK to make partner center calls + /// In all the mentioned cases, the token generated by LoginToPartnerCenter method should work. + /// + /// partner tenant id + /// SDK reference for contextual calls + public static async Task GetUserPartnerOperationsAsync(string PartnerId) + { + Tuple aadAuthenticationResult = await LoginToPartnerCenter(PartnerId); + + // Authenticate by user context with the partner service + IPartnerCredentials userCredentials = PartnerCredentials.Instance.GenerateByUserCredentials( + CPVApplicationId, + new AuthenticationToken( + aadAuthenticationResult.Item1, + aadAuthenticationResult.Item2), + async delegate + { + // token has expired, re-Login to Azure Active Directory + Tuple aadToken = await LoginToPartnerCenter(PartnerId); + return new AuthenticationToken(aadToken.Item1, aadToken.Item2); + }); + + return PartnerService.Instance.CreatePartnerOperations(userCredentials); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication/Properties/AssemblyInfo.cs b/secure-app-model/keyvault/CPVApplication/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..310c068 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("CPVApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CPVApplication")] +[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("9283af7a-6ca9-4373-93cb-f5d2130e1889")] + +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/secure-app-model/keyvault/CPVApplication/Utilities/ApiCalls.cs b/secure-app-model/keyvault/CPVApplication/Utilities/ApiCalls.cs new file mode 100644 index 0000000..8c4061e --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/Utilities/ApiCalls.cs @@ -0,0 +1,140 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CPVApplication.Utilities +{ + using System.IO; + using System.Net; + using System.Text; + using System.Threading.Tasks; + using Newtonsoft.Json.Linq; + + public static class ApiCalls + { + /// + /// Gets response for a REST api + /// + /// authorization token + /// REST url for the resource + /// response from the rest url + public static async Task GetAsync(string token, string url) + { + WebRequest request = WebRequest.Create(url); + request.Method = "GET"; + request.Headers.Add("Authorization", "Bearer " + token); + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + return Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); ; + } + } + } + + return null; + } + + /// + /// Post for a REST api + /// + /// authorization token + /// REST url for the resource + /// content + /// response from the rest url + public static async Task PostAsync(string token, string url, string content) + { + byte[] data = Encoding.UTF8.GetBytes(content); + WebRequest request = WebRequest.Create(url); + request.Method = "POST"; + request.ContentType = "application/json"; + request.Headers.Add("Authorization", "Bearer " + token); + request.ContentLength = data.Length; + + using (Stream stream = request.GetRequestStream()) + { + stream.Write(data, 0, data.Length); + } + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + return Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); ; + } + } + } + + return null; + } + + /// + /// Delete response for a REST api + /// + /// authorization token + /// REST url for the resource + /// response from the rest url + public static async Task DeleteAsync(string token, string url) + { + WebRequest request = WebRequest.Create(url); + request.Method = "DELETE"; + request.Headers.Add("Authorization", "Bearer " + token); + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + return Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); ; + } + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication/Utilities/AuthorizationUtilities.cs b/secure-app-model/keyvault/CPVApplication/Utilities/AuthorizationUtilities.cs new file mode 100644 index 0000000..8ec5149 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/Utilities/AuthorizationUtilities.cs @@ -0,0 +1,108 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CPVApplication.Utilities +{ + using System.IO; + using System.Net; + using System.Threading.Tasks; + using System.Web; + using Newtonsoft.Json.Linq; + + public static class AuthorizationUtilities + { + /// + /// Gets AAD token in refresh token flow + /// + /// AAD authority + /// Token audience + /// Marketplace application id + /// Marketplace application secret + /// refresh token + /// + public static async Task GetAADTokenFromRefreshToken(string authority, string audience, string clientId, string clientSecret, string refreshToken) + { + string loginUrl = string.Format("{0}/oauth2/token", authority); + + var request = WebRequest.Create(loginUrl); + + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + string content = string.Format( + "resource={0}&client_id={1}&client_secret={2}&grant_type=refresh_token&refresh_token={3}&scope=openid", + HttpUtility.UrlEncode(audience), + HttpUtility.UrlEncode(clientId), + HttpUtility.UrlEncode(clientSecret), + HttpUtility.UrlEncode(refreshToken)); + + return await GetResponse(request, content); + } + + /// + /// Gets AAD token in application only token in non-interactive service principal flow + /// + /// AAD authority + /// Token audience + /// AAD application id + /// AAD application secret + public static async Task GetADAppToken(string authority, string audience, string clientId, string clientSecret) + { + string loginUrl = string.Format("{0}/oauth2/token", authority); + + var request = WebRequest.Create(loginUrl); + + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + string content = string.Format( + "resource={0}&client_id={1}&client_secret={2}&grant_type=client_credentials", + HttpUtility.UrlEncode(audience), + HttpUtility.UrlEncode(clientId), + HttpUtility.UrlEncode(clientSecret)); + + return await GetResponse(request, content); + } + + /// + /// Helper function to execute webrequest and parse response as JObject + /// + /// web request + /// request content + /// + private static async Task GetResponse(WebRequest request, string content) + { + using (var writer = new StreamWriter(request.GetRequestStream())) + { + writer.Write(content); + } + + try + { + var response = await request.GetResponseAsync(); + using (var reader = new StreamReader(response.GetResponseStream())) + { + var responseContent = reader.ReadToEnd(); + var adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (var reader = new StreamReader(webException.Response.GetResponseStream())) + { + var responseContent = reader.ReadToEnd(); + } + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication/Utilities/KeyVaultProvider.cs b/secure-app-model/keyvault/CPVApplication/Utilities/KeyVaultProvider.cs new file mode 100644 index 0000000..b9f2a78 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/Utilities/KeyVaultProvider.cs @@ -0,0 +1,71 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CPVApplication.Utilities +{ + using System.Configuration; + using System.Net.Http; + using System.Threading.Tasks; + using Microsoft.Azure.KeyVault; + using Microsoft.Azure.KeyVault.Models; + using Newtonsoft.Json.Linq; + + /// + /// Provider for accessing secrets from the Azure KeyVault + /// + public class KeyVaultProvider + { + /// + /// The client used to perform HTTP operations. + /// + private static readonly HttpClient httpClient = new HttpClient(); + + /// + /// The base address for the instance of Azure Key Vault. + /// + private readonly string BaseUrl = ConfigurationManager.AppSettings["KeyVaultEndpoint"]; + + /// + /// The identifier for the Azure AD application configured to access the instance of Azure Key Vault. + /// + private readonly string KeyVaultClientId = ConfigurationManager.AppSettings["ida:KeyVaultClientId"]; + + /// + /// The application secret for the Azure AD application configured to access the instance of Azure Key Vault. + /// + private readonly string KeyVaultClientSecret = ConfigurationManager.AppSettings["ida:KeyVaultClientSecret"]; + + /// + /// The client used to interact with the instance of Azure Key Vault. + /// + private readonly KeyVaultClient keyVaultClient; + + /// + /// Initializes a new instance of the class. + /// + public KeyVaultProvider() + { + keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(GetToken), httpClient); + } + + /// + /// Gets the specified entity from the vault. + /// + /// Identifier of the entity to be retrieved. + /// The value retrieved from the vault. + public async Task GetSecretAsync(string key) + { + SecretBundle secret = await keyVaultClient.GetSecretAsync(BaseUrl, key.Replace("@", string.Empty).Replace(".", string.Empty)).ConfigureAwait(false); + return secret.Value; + } + + private async Task GetToken(string authority, string resource, string scope) + { + JObject tokenResult = await AuthorizationUtilities.GetADAppToken(authority, resource, KeyVaultClientId, KeyVaultClientSecret); + return tokenResult["access_token"].ToString(); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CPVApplication/packages.config b/secure-app-model/keyvault/CPVApplication/packages.config new file mode 100644 index 0000000..5d1d7c9 --- /dev/null +++ b/secure-app-model/keyvault/CPVApplication/packages.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication.sln b/secure-app-model/keyvault/CSPApplication.sln new file mode 100644 index 0000000..25f3c88 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSPApplication", "CSPApplication\CSPApplication.csproj", "{9283AF7A-6CA9-4373-93CB-F5D2130E1889}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3CBE281A-E046-480F-8FC6-34536B951BEC} + EndGlobalSection +EndGlobal diff --git a/secure-app-model/keyvault/CSPApplication/App.config b/secure-app-model/keyvault/CSPApplication/App.config new file mode 100644 index 0000000..78c4ad3 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/App.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication/CSPApplication.csproj b/secure-app-model/keyvault/CSPApplication/CSPApplication.csproj new file mode 100644 index 0000000..0406a45 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/CSPApplication.csproj @@ -0,0 +1,109 @@ + + + + + Debug + AnyCPU + {9283AF7A-6CA9-4373-93CB-F5D2130E1889} + Exe + CPVApplication + CPVApplication + v4.6.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.Azure.KeyVault.3.0.1\lib\net452\Microsoft.Azure.KeyVault.dll + + + ..\packages\Microsoft.Azure.KeyVault.WebKey.3.0.1\lib\net452\Microsoft.Azure.KeyVault.WebKey.dll + + + ..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.4.4.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + ..\packages\Microsoft.Rest.ClientRuntime.2.3.18\lib\net452\Microsoft.Rest.ClientRuntime.dll + + + ..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.18\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll + + + ..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.dll + + + ..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Extensions.dll + + + ..\packages\Microsoft.Store.PartnerCenter.1.10.0\lib\Net45\Microsoft.Store.PartnerCenter.Models.dll + + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll + + + + + + + + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + + + + + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll + + + + + + + + + + + + + + + + + + + Designer + + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication/Program.cs b/secure-app-model/keyvault/CSPApplication/Program.cs new file mode 100644 index 0000000..0cfc32a --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/Program.cs @@ -0,0 +1,150 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CSPApplication +{ + using System; + using System.Configuration; + using System.Threading.Tasks; + using CSPApplication.Utilities; + using Microsoft.Store.PartnerCenter; + using Microsoft.Store.PartnerCenter.Extensions; + using Microsoft.Store.PartnerCenter.Models; + using Microsoft.Store.PartnerCenter.Models.Users; + using Newtonsoft.Json; + + internal class Program + { + /// + /// The following code assumes that the context of the partner is pre determined by some external code + /// (based on marketplace application logic: either by product or by partner context) + /// + + private static readonly string CSPApplicationId = ConfigurationManager.AppSettings["ida:CSPApplicationId"]; + private static readonly string CSPApplicationSecret = ConfigurationManager.AppSettings["ida:CSPApplicationSecret"]; + + private static void Main(string[] args) + { + Task.Run(() => Run()).Wait(); + } + + private static async Task Run() + { + // The following properties indicate which partner and customer context the calls are going to be made. + string PartnerId = ""; + string CustomerId = ""; + + Console.WriteLine(" ===================== Partner center API calls ============================", DateTime.Now); + IAggregatePartner ops = await GetUserPartnerOperationsAsync(PartnerId); + SeekBasedResourceCollection customerUsers = ops.Customers.ById(CustomerId).Users.Get(); + Console.WriteLine(JsonConvert.SerializeObject(customerUsers)); + + Console.WriteLine(" ===================== Partner graph API calls ============================", DateTime.Now); + Tuple tokenResult = await LoginToGraph(PartnerId); + Newtonsoft.Json.Linq.JObject mydetails = await ApiCalls.GetAsync(tokenResult.Item1, "https://graph.microsoft.com/v1.0/me"); + Console.WriteLine(JsonConvert.SerializeObject(mydetails)); + + // CSP partner applications are pre-consented into customer tenant, so they do not need a custom consent from customer. + // direct token acquire to a customer tenant should work. + Console.WriteLine(" ===================== Customer graph API calls ============================", DateTime.Now); + Tuple tokenCustomerResult = await LoginToCustomerGraph(PartnerId, CustomerId); + Newtonsoft.Json.Linq.JObject customerDomainsUsingGraph = await ApiCalls.GetAsync(tokenCustomerResult.Item1, "https://graph.windows.net/" + CustomerId + "/domains?api-version=1.6"); + Console.WriteLine(JsonConvert.SerializeObject(customerDomainsUsingGraph)); + + Console.ReadLine(); + } + + public static async Task> LoginToPartnerCenter(string tenantId) + { + KeyVaultProvider provider = new KeyVaultProvider(); + string refreshToken = await provider.GetSecretAsync(tenantId); + + Newtonsoft.Json.Linq.JObject token = await AuthorizationUtilities.GetAADTokenFromRefreshToken( + "https://login.microsoftonline.com/" + tenantId, + "https://api.partnercenter.microsoft.com", + CSPApplicationId, + CSPApplicationSecret, + refreshToken); + + return new Tuple(token["access_token"].ToString(), DateTimeOffset.UtcNow + TimeSpan.FromTicks(long.Parse(token["expires_on"].ToString()))); + } + + /// + /// Generates a token for Partner tenant using partner user refresh token + /// The expiry time calculation explined below is not strong. + /// please use stardard ADAL library to gain access token by refresh token, which provides strongly typed classes with proper expirty time calculation. + /// + /// partner tenant id + /// + /// Access token and expiry time. + /// + public static async Task> LoginToGraph(string partnerTenantId) + { + KeyVaultProvider provider = new KeyVaultProvider(); + string refreshToken = await provider.GetSecretAsync(partnerTenantId); + + Newtonsoft.Json.Linq.JObject token = await AuthorizationUtilities.GetAADTokenFromRefreshToken( + "https://login.microsoftonline.com/" + partnerTenantId, + "https://graph.microsoft.com", + CSPApplicationId, + CSPApplicationSecret, + refreshToken); + + return new Tuple(token["access_token"].ToString(), DateTimeOffset.UtcNow + TimeSpan.FromTicks(long.Parse(token["expires_on"].ToString()))); + } + + /// + /// Generates a token for Customer tenant using partner user refresh token + /// The expiry time calculation explined below is not strong. + /// please use stardard ADAL library to gain access token by refresh token, which provides strongly typed classes with proper expirty time calculation. + /// + /// partner tenant id + /// customer tenant id + /// + /// Access token and expiry time. + /// + public static async Task> LoginToCustomerGraph(string partnerTenantId, string customerTenantId) + { + KeyVaultProvider provider = new KeyVaultProvider(); + string refreshToken = await provider.GetSecretAsync(partnerTenantId); + + Newtonsoft.Json.Linq.JObject token = await AuthorizationUtilities.GetAADTokenFromRefreshToken( + "https://login.microsoftonline.com/" + customerTenantId, + "https://graph.windows.net", + CSPApplicationId, + CSPApplicationSecret, + refreshToken); + + return new Tuple(token["access_token"].ToString(), DateTimeOffset.UtcNow + TimeSpan.FromTicks(long.Parse(token["expires_on"].ToString()))); + } + + /// + /// Using Partner center .NET SDK to make partner center calls. If you are using java application, you can either us REST calls or use Java SDK to make partner center calls + /// In all the mentioned cases, the token generated by LoginToPartnerCenter method should work. + /// + /// partner tenant id + /// SDK reference for contextual calls + public static async Task GetUserPartnerOperationsAsync(string PartnerId) + { + Tuple aadAuthenticationResult = await LoginToPartnerCenter(PartnerId); + + // Authenticate by user context with the partner service + IPartnerCredentials userCredentials = PartnerCredentials.Instance.GenerateByUserCredentials( + CSPApplicationId, + new AuthenticationToken( + aadAuthenticationResult.Item1, + aadAuthenticationResult.Item2), + async delegate + { + // token has expired, re-Login to Azure Active Directory + Tuple aadToken = await LoginToPartnerCenter(PartnerId); + return new AuthenticationToken(aadToken.Item1, aadToken.Item2); + }); + + return PartnerService.Instance.CreatePartnerOperations(userCredentials); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication/Properties/AssemblyInfo.cs b/secure-app-model/keyvault/CSPApplication/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a379108 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("CSPApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSPApplication")] +[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("9283af7a-6ca9-4373-93cb-f5d2130e1889")] + +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/secure-app-model/keyvault/CSPApplication/Utilities/ApiCalls.cs b/secure-app-model/keyvault/CSPApplication/Utilities/ApiCalls.cs new file mode 100644 index 0000000..278c8cb --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/Utilities/ApiCalls.cs @@ -0,0 +1,141 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CSPApplication.Utilities +{ + using System.IO; + using System.Net; + using System.Text; + using System.Threading.Tasks; + using Newtonsoft.Json.Linq; + + public static class ApiCalls + { + /// + /// Gets response for a REST api + /// + /// authorization token + /// REST url for the resource + /// response from the rest url + public static async Task GetAsync(string token, string url) + { + WebRequest request = WebRequest.Create(url); + request.Method = "GET"; + request.Headers.Add("Authorization", "Bearer " + token); + + try + { + WebResponse response = await request.GetResponseAsync(); + + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + return Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); ; + } + } + } + + return null; + } + + /// + /// Post for a REST api + /// + /// authorization token + /// REST url for the resource + /// content + /// response from the rest url + public static async Task PostAsync(string token, string url, string content) + { + byte[] data = Encoding.UTF8.GetBytes(content); + WebRequest request = WebRequest.Create(url); + request.Method = "POST"; + request.ContentType = "application/json"; + request.Headers.Add("Authorization", "Bearer " + token); + request.ContentLength = data.Length; + + using (Stream stream = request.GetRequestStream()) + { + stream.Write(data, 0, data.Length); + } + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + return Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); ; + } + } + } + + return null; + } + + /// + /// Delete response for a REST api + /// + /// authorization token + /// REST url for the resource + /// response from the rest url + public static async Task DeleteAsync(string token, string url) + { + WebRequest request = WebRequest.Create(url); + request.Method = "DELETE"; + request.Headers.Add("Authorization", "Bearer " + token); + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + return Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); ; + } + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication/Utilities/AuthorizationUtilities.cs b/secure-app-model/keyvault/CSPApplication/Utilities/AuthorizationUtilities.cs new file mode 100644 index 0000000..fc936b3 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/Utilities/AuthorizationUtilities.cs @@ -0,0 +1,108 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CSPApplication.Utilities +{ + using System.IO; + using System.Net; + using System.Threading.Tasks; + using System.Web; + using Newtonsoft.Json.Linq; + + public static class AuthorizationUtilities + { + /// + /// Gets AAD token in refresh token flow + /// + /// AAD authority + /// Token audience + /// Marketplace application id + /// Marketplace application secret + /// refresh token + /// + public static async Task GetAADTokenFromRefreshToken(string authority, string audience, string clientId, string clientSecret, string refreshToken) + { + string loginUrl = string.Format("{0}/oauth2/token", authority); + + WebRequest request = WebRequest.Create(loginUrl); + + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + string content = string.Format( + "resource={0}&client_id={1}&client_secret={2}&grant_type=refresh_token&refresh_token={3}&scope=openid", + HttpUtility.UrlEncode(audience), + HttpUtility.UrlEncode(clientId), + HttpUtility.UrlEncode(clientSecret), + HttpUtility.UrlEncode(refreshToken)); + + return await GetResponse(request, content); + } + + /// + /// Gets AAD token in application only token in non-interactive service principal flow + /// + /// AAD authority + /// Token audience + /// AAD application id + /// AAD application secret + public static async Task GetADAppToken(string authority, string audience, string clientId, string clientSecret) + { + string loginUrl = string.Format("{0}/oauth2/token", authority); + + WebRequest request = WebRequest.Create(loginUrl); + + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + string content = string.Format( + "resource={0}&client_id={1}&client_secret={2}&grant_type=client_credentials", + HttpUtility.UrlEncode(audience), + HttpUtility.UrlEncode(clientId), + HttpUtility.UrlEncode(clientSecret)); + + return await GetResponse(request, content); + } + + /// + /// Helper function to execute webrequest and parse response as JObject + /// + /// web request + /// request content + /// + private static async Task GetResponse(WebRequest request, string content) + { + using (StreamWriter writer = new StreamWriter(request.GetRequestStream())) + { + writer.Write(content); + } + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + } + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication/Utilities/KeyVaultProvider.cs b/secure-app-model/keyvault/CSPApplication/Utilities/KeyVaultProvider.cs new file mode 100644 index 0000000..8c520b2 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/Utilities/KeyVaultProvider.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace CSPApplication.Utilities +{ + using System.Configuration; + using System.Threading.Tasks; + using Microsoft.Azure.KeyVault; + using Microsoft.Azure.KeyVault.Models; + using Newtonsoft.Json.Linq; + + /// + /// Provider for accessing secrets from the Azure KeyVault + /// + public class KeyVaultProvider + { + private readonly string KeyVaultClientId = ConfigurationManager.AppSettings["ida:KeyVaultClientId"]; + private readonly string KeyVaultClientSecret = ConfigurationManager.AppSettings["ida:KeyVaultClientSecret"]; + private readonly string BaseUrl = ConfigurationManager.AppSettings["KeyVaultEndpoint"]; + + public async Task GetSecretAsync(string key) + { + KeyVaultClient keyVault = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(this.GetToken), new System.Net.Http.HttpClient()); + SecretBundle secret = await keyVault.GetSecretAsync(this.BaseUrl, key.Replace("@", string.Empty).Replace(".", string.Empty)); + return secret.Value; + } + + private async Task GetToken(string authority, string resource, string scope) + { + JObject tokenResult = await AuthorizationUtilities.GetADAppToken(authority, resource, this.KeyVaultClientId, this.KeyVaultClientSecret); + return tokenResult["access_token"].ToString(); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/CSPApplication/packages.config b/secure-app-model/keyvault/CSPApplication/packages.config new file mode 100644 index 0000000..647dbb5 --- /dev/null +++ b/secure-app-model/keyvault/CSPApplication/packages.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent.sln b/secure-app-model/keyvault/PartnerConsent.sln new file mode 100644 index 0000000..076127e --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PartnerConsent", "PartnerConsent\PartnerConsent.csproj", "{CCD6D318-8E1F-4825-9A2F-AFA6DF76933C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CCD6D318-8E1F-4825-9A2F-AFA6DF76933C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCD6D318-8E1F-4825-9A2F-AFA6DF76933C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCD6D318-8E1F-4825-9A2F-AFA6DF76933C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCD6D318-8E1F-4825-9A2F-AFA6DF76933C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {52BF6D3C-3E96-42D3-A9C7-0F0C18A3D962} + EndGlobalSection +EndGlobal diff --git a/secure-app-model/keyvault/PartnerConsent/App_Start/BundleConfig.cs b/secure-app-model/keyvault/PartnerConsent/App_Start/BundleConfig.cs new file mode 100644 index 0000000..6d6c4ae --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/App_Start/BundleConfig.cs @@ -0,0 +1,19 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent +{ + using System.Web.Optimization; + + public static class BundleConfig + { + public static void RegisterBundles(BundleCollection bundles) + { + bundles.Add(new StyleBundle("~/Content/css").Include( + "~/Content/site.css")); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/App_Start/FilterConfig.cs b/secure-app-model/keyvault/PartnerConsent/App_Start/FilterConfig.cs new file mode 100644 index 0000000..1e9e6ad --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/App_Start/FilterConfig.cs @@ -0,0 +1,18 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent +{ + using System.Web.Mvc; + + public static class FilterConfig + { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new HandleErrorAttribute()); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/App_Start/RouteConfig.cs b/secure-app-model/keyvault/PartnerConsent/App_Start/RouteConfig.cs new file mode 100644 index 0000000..fbce47c --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/App_Start/RouteConfig.cs @@ -0,0 +1,29 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent +{ + using System.Web.Mvc; + using System.Web.Routing; + + public static class RouteConfig + { + /// + /// Register ASP.NET routes for the web application + /// + /// + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/App_Start/Startup.Auth.cs b/secure-app-model/keyvault/PartnerConsent/App_Start/Startup.Auth.cs new file mode 100644 index 0000000..340a9d5 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/App_Start/Startup.Auth.cs @@ -0,0 +1,94 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent +{ + using System.Configuration; + using System.IdentityModel.Claims; + using System.Threading.Tasks; + using Microsoft.Owin.Security; + using Microsoft.Owin.Security.Cookies; + using Microsoft.Owin.Security.Notifications; + using Microsoft.Owin.Security.OpenIdConnect; + using Owin; + using Utilities; + + public partial class Startup + { + private static string CSPApplicationId = ConfigurationManager.AppSettings["ida:CSPApplicationId"]; + private static string CSPApplicationSecret = ConfigurationManager.AppSettings["ida:CSPApplicationSecret"]; + private static string AuthorityCommon = ConfigurationManager.AppSettings["ida:AADInstance"] + "common"; + + /// + /// Configure authentication pipeline + /// + /// Owin app builder + public void ConfigureAuth(IAppBuilder app) + { + app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); + + app.UseCookieAuthentication(new CookieAuthenticationOptions { }); + + app.UseOpenIdConnectAuthentication( + new OpenIdConnectAuthenticationOptions + { + ClientId = CSPApplicationId, + Authority = AuthorityCommon, + TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters + { + // instead of using the default validation (validating against a single issuer value, as we do in line of business apps), + // we inject our own multitenant validation logic + ValidateIssuer = false, + // If the app needs access to the entire organization, then add the logic + // of validating the Issuer here. + // IssuerValidator + }, + Notifications = new OpenIdConnectAuthenticationNotifications() + { + SecurityTokenValidated = (context) => + { + // If your authentication logic is based on users then add your logic here + return Task.FromResult(0); + }, + AuthenticationFailed = (context) => + { + // Pass in the context back to the app + context.OwinContext.Response.Redirect("/Home/Error"); + context.HandleResponse(); // Suppress the exception + return Task.FromResult(0); + }, + AuthorizationCodeReceived = HandleAuthorizationCodeReceivedNotification + } + }); + } + + /// + /// Recieve the AuthCode and exchange it for an access token and refresh token + /// + /// + private static async Task HandleAuthorizationCodeReceivedNotification(AuthorizationCodeReceivedNotification notificationMessage) + { + string signInUserId = notificationMessage.AuthenticationTicket.Identity.FindFirst(ClaimTypes.Upn).Value; + string partnerTenantId = notificationMessage.AuthenticationTicket.Identity.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value; + + // Acquire a token using AuthCode + Newtonsoft.Json.Linq.JObject tokenResult = await AuthorizationUtilities.GetAADTokenFromAuthCode( + "https://login.microsoftonline.com/" + partnerTenantId, + "https://api.partnercenter.microsoft.com", + CSPApplicationId, + CSPApplicationSecret, + notificationMessage.Code, + notificationMessage.OwinContext.Request.Uri.ToString()); + + string refreshToken = tokenResult["refresh_token"].ToString(); + + // Store the refresh token using partner tenant id as the key. + // Marketplace application will use the partner tenant id as a key to retrive the refresh token to get authenticated against the user. + KeyVaultProvider provider = new KeyVaultProvider(); + await provider.AddSecretAsync(partnerTenantId, refreshToken); + } + } +} diff --git a/secure-app-model/keyvault/PartnerConsent/ApplicationInsights.config b/secure-app-model/keyvault/PartnerConsent/ApplicationInsights.config new file mode 100644 index 0000000..75e12df --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/ApplicationInsights.config @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/Content/Site.css b/secure-app-model/keyvault/PartnerConsent/Content/Site.css new file mode 100644 index 0000000..6ea5d8f --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Content/Site.css @@ -0,0 +1,24 @@ +body { + padding-top: 50px; + padding-bottom: 20px; +} + +/* Set padding to keep content from hitting the edges */ +.body-content { + padding-left: 15px; + padding-right: 15px; +} + +/* Override the default bootstrap behavior where horizontal description lists + will truncate terms that are too long to fit in the left column +*/ +.dl-horizontal dt { + white-space: normal; +} + +/* Set width on the form input elements since they're 100% wide by default */ +input, +select, +textarea { + max-width: 280px; +} diff --git a/secure-app-model/keyvault/PartnerConsent/Controllers/HomeController.cs b/secure-app-model/keyvault/PartnerConsent/Controllers/HomeController.cs new file mode 100644 index 0000000..012b1a3 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Controllers/HomeController.cs @@ -0,0 +1,33 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent.Controllers +{ + using System.Web.Mvc; + + [Authorize] + public class HomeController : Controller + { + /// + /// Homepage - this is an example of response the consent application can present + /// + /// + public ActionResult Index() + { + return View(); + } + + /// + /// Error page controller to capture exceptions. + /// This is default implementation and must be tuned to specific experience for an application + /// + /// + public ActionResult Error() + { + return View(); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/Global.asax b/secure-app-model/keyvault/PartnerConsent/Global.asax new file mode 100644 index 0000000..54faa36 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="PartnerConsent.MvcApplication" Language="C#" %> diff --git a/secure-app-model/keyvault/PartnerConsent/Global.asax.cs b/secure-app-model/keyvault/PartnerConsent/Global.asax.cs new file mode 100644 index 0000000..aff9e5c --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Global.asax.cs @@ -0,0 +1,23 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent +{ + using System.Web.Mvc; + using System.Web.Optimization; + using System.Web.Routing; + + public class MvcApplication : System.Web.HttpApplication + { + protected void Application_Start() + { + AreaRegistration.RegisterAllAreas(); + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); + RouteConfig.RegisterRoutes(RouteTable.Routes); + BundleConfig.RegisterBundles(BundleTable.Bundles); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/PartnerConsent.csproj b/secure-app-model/keyvault/PartnerConsent/PartnerConsent.csproj new file mode 100644 index 0000000..9e16958 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/PartnerConsent.csproj @@ -0,0 +1,241 @@ + + + + + + + Debug + AnyCPU + + + 2.0 + {CCD6D318-8E1F-4825-9A2F-AFA6DF76933C} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + PartnerConsent + PartnerConsent + v4.6.1 + false + true + + 44395 + + + + + + + 0 + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll + + + ..\packages\Microsoft.Azure.KeyVault.3.0.1\lib\net452\Microsoft.Azure.KeyVault.dll + + + ..\packages\Microsoft.Azure.KeyVault.WebKey.3.0.1\lib\net452\Microsoft.Azure.KeyVault.WebKey.dll + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + ..\packages\Microsoft.IdentityModel.JsonWebTokens.5.3.0\lib\net461\Microsoft.IdentityModel.JsonWebTokens.dll + + + ..\packages\Microsoft.IdentityModel.Logging.5.3.0\lib\net461\Microsoft.IdentityModel.Logging.dll + + + ..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.4.403061554\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll + + + ..\packages\Microsoft.IdentityModel.Protocols.5.3.0\lib\net461\Microsoft.IdentityModel.Protocols.dll + + + ..\packages\Microsoft.IdentityModel.Protocols.OpenIdConnect.5.3.0\lib\net461\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll + + + ..\packages\Microsoft.IdentityModel.Tokens.5.3.0\lib\net461\Microsoft.IdentityModel.Tokens.dll + + + ..\packages\Microsoft.Owin.4.0.0\lib\net451\Microsoft.Owin.dll + + + ..\packages\Microsoft.Owin.Host.SystemWeb.4.0.0\lib\net451\Microsoft.Owin.Host.SystemWeb.dll + + + ..\packages\Microsoft.Owin.Security.4.0.0\lib\net451\Microsoft.Owin.Security.dll + + + ..\packages\Microsoft.Owin.Security.Cookies.4.0.0\lib\net451\Microsoft.Owin.Security.Cookies.dll + + + ..\packages\Microsoft.Owin.Security.OpenIdConnect.4.0.0\lib\net451\Microsoft.Owin.Security.OpenIdConnect.dll + + + ..\packages\Microsoft.Rest.ClientRuntime.2.3.18\lib\net452\Microsoft.Rest.ClientRuntime.dll + + + ..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.18\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + + + + + + + ..\packages\System.IdentityModel.Tokens.Jwt.5.3.0\lib\net461\System.IdentityModel.Tokens.Jwt.dll + + + + + + + + + + + + + + ..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.6\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll + + + ..\packages\Microsoft.AspNet.Razor.3.2.6\lib\net45\System.Web.Razor.dll + + + + ..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.Deployment.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.Razor.dll + + + + + + + + + + + ..\packages\WebGrease.1.6.0\lib\WebGrease.dll + + + + + + + + + + + Global.asax + + + + + + + + + + + + Web.config + + + Web.config + + + + + + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + + + True + True + 3376 + / + https://localhost:44395/ + False + False + + + False + + + + + + + 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/secure-app-model/keyvault/PartnerConsent/Properties/AssemblyInfo.cs b/secure-app-model/keyvault/PartnerConsent/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..aed4309 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +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("PartnerConsent")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PartnerConsent")] +[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("4fcd2826-5f2b-45ba-9268-172736b3e212")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/secure-app-model/keyvault/PartnerConsent/Startup.cs b/secure-app-model/keyvault/PartnerConsent/Startup.cs new file mode 100644 index 0000000..0f607e0 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Startup.cs @@ -0,0 +1,20 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +[assembly: Microsoft.Owin.OwinStartup(typeof(PartnerConsent.Startup))] + +namespace PartnerConsent +{ + using Owin; + + public partial class Startup + { + public void Configuration(IAppBuilder app) + { + ConfigureAuth(app); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/Utilities/AuthorizationUtilities.cs b/secure-app-model/keyvault/PartnerConsent/Utilities/AuthorizationUtilities.cs new file mode 100644 index 0000000..22d1f24 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Utilities/AuthorizationUtilities.cs @@ -0,0 +1,110 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent.Utilities +{ + using System.IO; + using System.Net; + using System.Threading.Tasks; + using System.Web; + using Newtonsoft.Json.Linq; + + public static class AuthorizationUtilities + { + /// + /// Gets AAD token in auth-code interactive login flow + /// + /// AAD authority + /// Token audience + /// Marketplace application id + /// Marketplace application secret + /// Auth-Code recieved from AAD in interactive login flow + /// Marketplace application redirect url + /// + public static async Task GetAADTokenFromAuthCode(string authority, string audience, string clientId, string clientSecret, string authCode, string redirectUrl) + { + string loginUrl = string.Format("{0}/oauth2/token", authority); + WebRequest request = WebRequest.Create(loginUrl); + + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + // Use grant_type=authorization_code to get a token using authorization code + string content = string.Format( + "resource={0}&client_id={1}&client_secret={2}&grant_type=authorization_code&code={3}&redirect_uri={4}", + HttpUtility.UrlEncode(audience), + HttpUtility.UrlEncode(clientId), + HttpUtility.UrlEncode(clientSecret), + HttpUtility.UrlEncode(authCode), + HttpUtility.UrlEncode(redirectUrl)); + + return await GetResponse(request, content); + } + + /// + /// Gets AAD token in application only token in non-interactive service principal flow + /// + /// AAD authority + /// Token audience + /// AAD application id + /// AAD application secret + public static async Task GetADAppToken(string authority, string audience, string clientId, string clientSecret) + { + string loginUrl = string.Format("{0}/oauth2/token", authority); + + WebRequest request = WebRequest.Create(loginUrl); + + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + string content = string.Format( + "resource={0}&client_id={1}&client_secret={2}&grant_type=client_credentials", + HttpUtility.UrlEncode(audience), + HttpUtility.UrlEncode(clientId), + HttpUtility.UrlEncode(clientSecret)); + + return await GetResponse(request, content); + } + + /// + /// Helper function to execute webrequest and parse response as JObject + /// + /// web request + /// request content + /// + private static async Task GetResponse(WebRequest request, string content) + { + using (StreamWriter writer = new StreamWriter(request.GetRequestStream())) + { + writer.Write(content); + } + + try + { + WebResponse response = await request.GetResponseAsync(); + using (StreamReader reader = new StreamReader(response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + JObject adResponse = + Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return adResponse; + } + } + catch (WebException webException) + { + if (webException.Response != null) + { + using (StreamReader reader = new StreamReader(webException.Response.GetResponseStream())) + { + string responseContent = reader.ReadToEnd(); + } + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/Utilities/KeyVaultProvider.cs b/secure-app-model/keyvault/PartnerConsent/Utilities/KeyVaultProvider.cs new file mode 100644 index 0000000..ba96ee9 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Utilities/KeyVaultProvider.cs @@ -0,0 +1,65 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ----------------------------------------------------------------------- + +namespace PartnerConsent.Utilities +{ + using System.Configuration; + using System.Threading.Tasks; + using Microsoft.Azure.KeyVault; + using Microsoft.Azure.KeyVault.Models; + + + /// + /// Provider for accessing secrets from the Azure KeyVault + /// + public class KeyVaultProvider + { + private readonly string KeyVaultClientId = ConfigurationManager.AppSettings["ida:KeyVaultClientId"]; + private readonly string KeyVaultClientSecret = ConfigurationManager.AppSettings["ida:KeyVaultClientSecret"]; + private readonly string BaseUrl = ConfigurationManager.AppSettings["KeyVaultEndpoint"]; + + /// + /// Get secret value from azure key vault + /// + /// key name + /// key value in string format + public async Task GetSecretAsync(string key) + { + KeyVaultClient keyVault = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(this.GetToken), new System.Net.Http.HttpClient()); + + string secretIdentifier = this.BaseUrl + "/secrets/" + key.Replace("@", string.Empty).Replace(".", string.Empty); + SecretBundle secret = await keyVault.GetSecretAsync(secretIdentifier); + + return secret.Value; + } + + /// + /// Add or overrides a key value in Azure key vault + /// + /// key name + /// secret value + /// + public async Task AddSecretAsync(string key, string value) + { + KeyVaultClient keyVault = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(this.GetToken), new System.Net.Http.HttpClient()); + await keyVault.SetSecretAsync(this.BaseUrl, key.Replace("@", string.Empty).Replace(".", string.Empty), value); + } + + /// + /// Get application token for the app which is given access to Azure keyvault + /// Called by delegate in azure key vault SDK + /// + /// AAD authority + /// Azure key vault resource + /// authorization scope + /// + private async Task GetToken(string authority, string resource, string scope) + { + Newtonsoft.Json.Linq.JObject tokenResult = await AuthorizationUtilities.GetADAppToken(authority, resource, this.KeyVaultClientId, this.KeyVaultClientSecret); + return tokenResult["access_token"].ToString(); + } + } +} \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/Views/Home/Index.cshtml b/secure-app-model/keyvault/PartnerConsent/Views/Home/Index.cshtml new file mode 100644 index 0000000..6170a0a --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Views/Home/Index.cshtml @@ -0,0 +1,19 @@ +@inherits System.Web.Mvc.WebViewPage + +
+

Partner Consent

+
+ +
+
+

Consent successful

+

+ Partner consent to application has been granted. + For more information on how to manage the application in your Active directory tenant, please check here + You can manage applications at https://myapps.microsoft.com +

+

+ close +

+
+
\ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/Views/Shared/Error.cshtml b/secure-app-model/keyvault/PartnerConsent/Views/Shared/Error.cshtml new file mode 100644 index 0000000..be55b17 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Views/Shared/Error.cshtml @@ -0,0 +1,9 @@ +@model System.Web.Mvc.HandleErrorInfo + +@{ + ViewBag.Title = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ diff --git a/secure-app-model/keyvault/PartnerConsent/Views/Shared/_Layout.cshtml b/secure-app-model/keyvault/PartnerConsent/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000..34933de --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Views/Shared/_Layout.cshtml @@ -0,0 +1,16 @@ + + + + + + Partner Consent + @Styles.Render("~/Content/css") + @Scripts.Render("~/bundles/modernizr") + + +
+ @RenderBody() +
+ @RenderSection("scripts", required: false) + + diff --git a/secure-app-model/keyvault/PartnerConsent/Views/Web.config b/secure-app-model/keyvault/PartnerConsent/Views/Web.config new file mode 100644 index 0000000..e3f2a4b --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Views/Web.config @@ -0,0 +1,43 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/secure-app-model/keyvault/PartnerConsent/Views/_ViewStart.cshtml b/secure-app-model/keyvault/PartnerConsent/Views/_ViewStart.cshtml new file mode 100644 index 0000000..2de6241 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} diff --git a/secure-app-model/keyvault/PartnerConsent/Web.Debug.config b/secure-app-model/keyvault/PartnerConsent/Web.Debug.config new file mode 100644 index 0000000..d7712aa --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/secure-app-model/keyvault/PartnerConsent/Web.Release.config b/secure-app-model/keyvault/PartnerConsent/Web.Release.config new file mode 100644 index 0000000..28a4d5f --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/secure-app-model/keyvault/PartnerConsent/Web.config b/secure-app-model/keyvault/PartnerConsent/Web.config new file mode 100644 index 0000000..b9d2535 --- /dev/null +++ b/secure-app-model/keyvault/PartnerConsent/Web.config @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/secure-app-model/keyvault/PartnerConsent/favicon.ico b/secure-app-model/keyvault/PartnerConsent/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3a799985c43bc7309d701b2cad129023377dc71 GIT binary patch literal 32038 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file