PowerShell standards and documentation cleanup (#61)

* First pass of the script analyzer fixes

* Fixed: Plural PowerShell Nouns

Added non-plural version of each cmdlet that used a plural name. Updated documentation to match.

* Documentation Updates and cmdlets

Updated documentation and added non-plural versions of the existing cmdlets.

* Added warning text to deprecated cmdlets

Added warning text to deprecated cmdlets. Also added some details to some of the cmdlet help files about authentication and specific parameters.
This commit is contained in:
Joel Stidley 2018-05-22 21:33:23 -05:00 коммит произвёл Isaiah Williams
Родитель ebc07136de
Коммит e768c6ea18
93 изменённых файлов: 1124 добавлений и 655 удалений

Просмотреть файл

@ -1,14 +1,27 @@
# Partner Center PowerShell Module Changelog
## 0.9.0.20 (2018-05-14)
## 0.9.0.21 (2018-05-22)
### Features
* No new features were added
* Removed telemetry functions
* Added non-plural cmdlets names to comply with PowerShell standards
* Get-PCAuditRecord
* Get-PCCustomerLicenseDeployment
* Get-PCCustomerLicenseUsage
* Get-PCCustomerRelationship
* Get-PCIndirectReseller
* Get-PCLicenseUsage
* Get-PCLicenseDeployment
* Get-PCManagedSerice
* Get-PCResellerCustomer
* Get-PCSRTopic
* Get-PCSubscribedSKU
### Bug Fixes
* Addressed an issue with the New-PCCustomer cmdlet that was preventing customers currently.
* Addressed an issue where Get-PCOfferCategoriesByMarket did not require the countryId, however the API does require this.
### Breaking Changes

Просмотреть файл

@ -11,32 +11,32 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
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](#coc)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Code of Conduct](#code-of-conduct)
- [Issues and Bugs](#finding-issues)
- [Feature Requests](#requesting-features)
- [Submission Guidelines](#submission-guidelines)
## <a name="coc"></a> Code of Conduct
## Code of Conduct
Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
## <a name="issue"></a> Found an Issue?
## 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](#submit-issue) to the GitHub Repository. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.
[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.
## <a name="feature"></a> Want a Feature?
## Requesting Features
You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
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](#submit-pr).
**Small Features** can be crafted and directly [submitted as a Pull Request](#submitting-a-pull-request).
## <a name="submit"></a> Submission Guidelines
## Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
### Submitting an Issue
Before you submit an issue, search the archive, maybe your question was already answered.
@ -54,13 +54,13 @@ chances of your issue being dealt with quickly:
- **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/PartnerCenterPowerShellModule/issues/new.
You can file new issues by providing the above information at the [corresponding repository's issues link](https://github.com/Microsoft/PartnerCenterPowerShellModule/issues/new).
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
### Submitting a Pull Request
Before you submit your Pull Request (PR) consider the following guidelines:
- Search the repository (https://github.com/Microsoft/PartnerCenterPowerShellModule/pulls) for an open or closed PR
- [Search the repository](https://github.com/Microsoft/PartnerCenterPowerShellModule/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:

Просмотреть файл

@ -1,18 +1,18 @@
# Partner Center PowerShell Module (preview) #
# Add-PCAuthentication #
## Add-PCAuthentication ##
## Set a global token for the script session - user authentication ##
**Set a global token for the script session - user authentication**
```powershell
$cred = Get-Credential
Add-PCAuthentication -cspappID '<native app id GUID>' -cspDomain '<csp partner domain>' -credential $cred
```
$credential = Get-Credential
Add-PCAuthentication -cspappID '<native app id GUID>' -cspDomain '<csp partner domain>' -credential $credential
**Set a global token for the script session - app authentication**
## Set a global token for the script session - app authentication ##
```powershell
$clientSecret = '<key code secret>'
$clientSecretSecure = $clientSecret | ConvertTo-SecureString -AsPlainText -Force
Add-PCAuthentication -cspappID '<web app id GUID>' -cspDomain '<csp partner domain>' -cspClientSecret $clientSecretSecure
```
You can obtain the Web App ID and the Client Secret from either Partner Center UI or Azure Active Directory

Просмотреть файл

@ -1,23 +1,27 @@
# Partner Center PowerShell Module (preview) #
# Add-PCCustomerRoleMember #
## Add-PCCustomerRoleMember ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get a role**
## Get a role ##
```powershell
$role = Get-PCCustomerRole -tenantid $customer.id | Where-Object name -Contains '<role name>'
```
**Get a User**
## Get a User ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -userid '<user id guid>'
```
**Add a User to a Role**
## Add a User to a Role ##
```powershell
$customerRoleMember = [DirectoryRoleMember]::new()
$customerRoleMember.id = $user.id
Add-PCCustomerRoleMember -tenantid $customer.id -roleid $role.id -customerrolemember $customerRoleMember
```

Просмотреть файл

@ -1,9 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Get-PCAddressRulesByMarket #
## Get-PCAddressRulesByMarket ##
**Get all address rules for countryid**
## Get all address rules for countryid ##
```powershell
Get-PCAddressRulesByMarket -countryid '<country two digits id>'
```

Просмотреть файл

@ -0,0 +1,19 @@
# Get-PCAuditRecord #
## Get audit logs starting from a specific date ##
```powershell
Get-PCAuditRecord -startDate '2017-04-12'
```
## Get audit logs between two dates ##
```powershell
Gett-PCAuditRecord -startDate '2017-04-12' -endDate '2017-04-13'
```
## Get audit logs of a specific operationType between two dates ##
```powershell
Get-PCAuditRecord -startDate '2017-04-12' -endDate '2017-04-13' | ? operationType -EQ 'delete_customer_user'
```

Просмотреть файл

@ -1,17 +1,21 @@
# Partner Center PowerShell Module (preview) #
# Get-PCAuditRecords #
## Get-PCAuditRecords ##
## Deprecated: Please use Get-PCAuditRecord ##
**Get audit logs starting from a specific date**
## Get audit logs starting from a specific date ##
```powershell
Get-PCAuditRecords -startDate '2017-04-12'
```
**Get audit logs between two dates**
## Get audit logs between two dates ##
```powershell
Gett-PCAuditRecords -startDate '2017-04-12' -endDate '2017-04-13'
```
**Get audit logs of a specific operationType between two dates**
## Get audit logs of a specific operationType between two dates ##
```powershell
Get-PCAuditRecords -startDate '2017-04-12' -endDate '2017-04-13' | ? operationType -EQ 'delete_customer_user'
```

Просмотреть файл

@ -1,13 +1,16 @@
# Partner Center PowerShell Module (preview) #
# Get-PCAzureRateCard #
## Get-PCAzureRateCard ##
**Get azure rate card (meters) for default context**
## Get Azure rate card (meters) for default context ##
```powershell
Get-PCAzureRateCard
```
**Get azure rate card for specific currency and region**
- **currency** Optional three letter ISO code for the currency in which the resource rates will be provided (e.g. "EUR"). The default is the currency associated with the market in the partner profile.
- **region** Optional two-letter ISO country/region code that indicates the market where the offer is purchased (e.g. "FR"). The default is the country/region code set in the partner profile.
## Get Azure rate card for specific currency and region ##
```powershell
Get-PCAzureRateCard -currency '<three digits currency>' -region '<two digits region code>'
```

Просмотреть файл

@ -1,9 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Get-PCBillingProfile #
## Get-PCBillingProfile ##
**Get Partner Billing Profile**
## Get Partner Billing Profile ##
```powershell
Get-PCBillingProfile
```

Просмотреть файл

@ -1,18 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomer #
## Get-PCCustomer ##
**Get all customers**
## Get all customers ##
```powershell
Get-PCCustomer -all
```
**Get a customer by ID**
## Get a customer by ID ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customers by company name**
## Get customers by company name ##
```powershell
Get-PCCustomer -startswith '<company name>'
```

Просмотреть файл

@ -1,13 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerBillingProfile #
## Get-PCCustomerBillingProfile ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer Billing Profile**
## Get customer billing profile ##
```powershell
Get-PCCustomerBillingProfile -tenantid $customer.id
```

Просмотреть файл

@ -1,13 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerCompanyProfile #
## Get-PCCustomerCompanyProfile ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer Company Profile**
## Get customer company profile ##
```powershell
Get-PCCustomerCompanyProfile -tenantid $customer.id
```

Просмотреть файл

@ -0,0 +1,15 @@
# Get-PCCustomerLicenseDeployment #
This cmdlet requires App+User authentication
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
## Get customer licenses deployment information ##
```powershell
Get-PCCustomerLicenseDeployment -tenantid $customer.id
```

Просмотреть файл

@ -0,0 +1,15 @@
# Get-PCCustomerLicenseUsage #
This cmdlet requires App+User authentication
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
## Get customer license usage information ##
```powershell
Get-PCCustomerLicenseUsage -tenantid $customer.id
```

Просмотреть файл

@ -1,13 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerLicensesDeployment #
## Get-PCCustomerLicensesDeployment ##
## Deprecated: Use Get-PCCustomerLicenseDeployment instead ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer licenses deployment information**
## Get customer licenses deployment information ##
```powershell
Get-PCCustomerLicensesDeployment -tenantid $customer.id
```

Просмотреть файл

@ -1,13 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerLicensesUsage #
## Get-PCCustomerLicensesUsage ##
## Deprecated: Please use Get-PCCustomerLicenseUsage instead ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer licenses usage information**
## Get customer licenses usage information ##
```powershell
Get-PCCustomerLicensesUsage -tenantid $customer.id
```

Просмотреть файл

@ -0,0 +1,13 @@
# Get-PCCustomerRelationship (indirect model only) #
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
## Get all customer subscriptions ##
```powershell
Get-PCCustomerRelationship -tenantid $customer.id
```

Просмотреть файл

@ -1,13 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerRelationships (indirect model only) #
## Get-PCCustomerRelationships (indirect model only)##
## Deprecated: Please use Get-PCCustomerRelationship instead ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get all customer subscriptions**
## Get all customer subscriptions ##
```powershell
Get-PCCustomerRelationships -tenantid $customer.id
```

Просмотреть файл

@ -1,13 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerRole #
## Get-PCCustomerRole ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer roles**
## Get customer roles ##
```powershell
Get-PCCustomerRole -tenantid $customer.id
```

Просмотреть файл

@ -1,17 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerRoleMember #
## Get-PCCustomerRoleMember ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer role**
## Get customer role ##
```powershell
$role = Get-PCCustomerRole -tenantid $customer.id | Where-Object Name -EQ '<Role Name>'
```
**Get customer user roles**
## Get customer user roles ##
```powershell
Get-PCCustomerRoleMember -tenantid $customer.id -roleid $role.id
```

Просмотреть файл

@ -1,14 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerServiceCostSummary #
## Get-PCCustomerServiceCostSummary ##
**Select a customer**
## Select a customer ##
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer Service Cost Summary**
## Get customer Service Cost Summary ##
```powershell
Get-PCCustomerServiceCostSummary -BillingPeriod MostRecent
```
> Other BillingPeriod type will be available in next release
> Other BillingPeriod type will be available in a future release

Просмотреть файл

@ -1,12 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerUsageSummary #
## Get-PCCustomerUsageSummary ##
## Select a customer ##
**Get a customer**
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
**Get usage summary for all of a customer's subscriptions**
## Get usage summary for all of a customer's subscriptions ##
```powershell
Get-PCCustomerUsageSummary -tenantid $customer.id
```

Просмотреть файл

@ -1,24 +1,25 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerUser #
## Get-PCCustomerUser ##
**Get a customer**
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
**Get all customer users**
## Get all customer users ##
```powershell
Get-PCCustomerUser -tenantid $customer.id -all
```
**Get customer user**
## Get customer user ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -userid '<user id>'
```
**Get customer user assigned licenses**
## Get customer user assigned licenses ##
```powershell
Get-PCCustomerUser -tenantid $customer.id -userid $user.id -licenses
```
**Get customer deleted users**
## Get customer deleted users ##
```powershell
Get-PCCustomerUser -tenantid $customer.id -deleted
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCCustomerUserRole #
## Get-PCCustomerUserRole ##
## Select a customer ##
**Get a customer**
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
**Get customer user**
## Get customer user ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -userid '<user id>'
```
**Get customer user roles**
## Get customer user roles ##
```powershell
Get-PCCustomerUserRole -tenantid $customer.id -user $user
```

Просмотреть файл

@ -1,10 +1,9 @@
# Partner Center PowerShell Module (preview) #
# Get-PCDomainAvailability #
## Get-PCDomainAvailability ##
**Check if domain is available to use on new customer**
## Check if domain is available to use on new customer ##
```powershell
$domainname = '<name>'
$domain = $domainname+'.onmicrosoft.com'
Get-PCDomainAvailability -domain $domain
```

Просмотреть файл

@ -0,0 +1,7 @@
# Get-PCIndirectReseller (indirect model only) #
## Get all indirect resellers ##
```powershell
Get-PCIndirectReseller
```

Просмотреть файл

@ -1,9 +1,9 @@
# Partner Center PowerShell Module (preview) #
# Get-PCIndirectResellers (indirect model only) #
## Get-PCIndirectResellers (indirect model only) ##
## Deprecated: Please use Get-PCIndirectReseller ##
## Get all indirect resellers ##
**Get all indirect resellers**
```powershell
Get-PCIndirectResellers
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCInvoice #
## Get-PCInvoice ##
**Get current payable amount**
## Get current payable amount ##
```powershell
Get-PCInvoice -summary
```
**Get all invoices**
## Get all invoices ##
```powershell
Get-PCInvoice -all
```
**Get an invoice**
## Get an invoice ##
```powershell
$invoice = Get-PCInvoice -invoiceid '<invoice id>'
```

Просмотреть файл

@ -0,0 +1,13 @@
# Get-PCInvoiceLineItem #
## Get an invoice ##
```powershell
$invoice = Get-PCInvoice -invoiceid '<invoice id>'
```
## Get an invoice line item ##
```powershell
Get-PCInvoiceLineItem -invoiceid $invoice.id -billingprovider '<provider>' -invoicelineitemtype '<line item type>'
```

Просмотреть файл

@ -1,12 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCInvoiceLineItems #
## Get-PCInvoiceLineItems ##
## Deprecated: Use Get-PCInvoiceLineItem instead ##
**Get an invoice**
## Get an invoice ##
```powershell
$invoice = Get-PCInvoice -invoiceid '<invoice id>'
```
**Get an invoice line items**
## Get an invoice line item ##
```powershell
Get-PCInvoiceLineItems -invoiceid $invoice.id -billingprovider '<provider>' -invoicelineitemtype '<line item type>'
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Get-PCLegalBusinessProfile #
## Get-PCLegalBusinessProfile ##
**Get Partner Legal Business Profile**
## Get Partner Legal Business Profile ##
```powershell
Get-PCLegalBusinessProfile
```

Просмотреть файл

@ -0,0 +1,7 @@
# Get-PCLicenseDeployment #
## Get partner license deployment information ##
```powershell
Get-PCLicenseDeployment
```

Просмотреть файл

@ -0,0 +1,7 @@
# Get-PCLicenseUsage #
## Get partner license usage information ##
```powershell
Get-PCLicenseUsage
```

Просмотреть файл

@ -1,8 +1,9 @@
# Partner Center PowerShell Module (preview) #
# Get-PCLicensesDeployment #
## Get-PCLicensesDeployment ##
## Deprecated: Use Get-PCLicenseDeployment instead ##
**Get partner licenses deployment information**
## Get partner licenses deployment information ##
```powershell
Get-PCLicensesDeployment
```

Просмотреть файл

@ -1,8 +1,9 @@
# Partner Center PowerShell Module (preview) #
# Get-PCLicensesUsage #
## Get-PCLicensesUsage ##
## Deprecated: Use Get-PCLicenseUsage instead ##
**Get partner licenses usage information**
## Get partner licenses usage information ##
```powershell
Get-PCLicensesUsage
```

Просмотреть файл

@ -0,0 +1,13 @@
# Get-PCManagedService #
## Select a customer ##
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
## Get all managed services for specified customer ##
```powershell
Get-PCManagedService -tenantid $customer.id
```

Просмотреть файл

@ -1,12 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCManagedServices #
## Get-PCManagedServices ##
## Deprecated: Use Get-PCManagedService instead ##
**Get a customer**
## Select a customer ##
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
**Get all managed services for customer**
## Get all managed services for customer ##
```powershell
Get-PCManagedServices -tenantid $customer.id
```

Просмотреть файл

@ -1,12 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Get-PCMpnProfile #
## Get-PCMpnProfile ##
**Get Partner MPN Profile**
## Get Partner MPN Profile ##
```powershell
Get-PCMpnProfile
```
**Get a Partner MPN Profile by MPNID**
## Get a Partner MPN Profile by MPNID ##
```powershell
Get-PCMpnProfile -mpnid <MPNId>
```

Просмотреть файл

@ -1,21 +1,25 @@
# Partner Center PowerShell Module (preview) #
# Get-PCOffer #
## Get-PCOffer ##
## Get all offer details for countryId ##
**Get all Offers details for countryid**
```powershell
Get-PCOffer -countryId '<country two digits id>'
```
Get-PCOffer -countryid '<country two digits id>'
## Get a specific offer ##
**Get a specific Offer**
```powershell
Get-PCOffer -countryId '<country two digits id>' -offerId '<offer id GUID>'
```
Get-PCOffer -countryid '<country two digits id>' -offerid '<offer id GUID>'
## Get all offer details for countryId and localeId ##
**Get all Offers details for countryid and localeid**
Get-PCOffer -countryid '<country two digits id>' -localeid '<locale id four digits>'
**Get addons for a specific Offer**
Get-PCOffer -countryid '<country two digits id>' -offerid '<offer id GUID>' -addons
```powershell
Get-PCOffer -countryId '<country two digits id>' -localeId '<locale id four digits>'
```
## Get addons for a specific offer ##
```powershell
Get-PCOffer -countryId '<country two digits id>' -offerId '<offer id GUID>' -addOns
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Get-PCOfferCategoriesByMarket #
## Get-PCOfferCategoriesByMarket ##
**Get all Offers Categories for countryid**
## Get all Offers Categories for countryid ##
```powershell
Get-PCOfferCategoriesByMarket -countryid '<country two digits id>'
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCOrder #
## Get-PCOrder ##
## Select a customer ##
**Get a customer**
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
**Get customer orders**
## Get customer orders ##
```powershell
Get-PCOrder -tenantid $customer.id
```
**Get a customer order**
## Get a customer order ##
```powershell
Get-PCOrder -tenantid $customer.id -orderid '<order id guid>'
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Get-PCOrganizationProfile #
## Get-PCOrganizationProfile ##
**Get Partner Organization Profile**
## Get Partner Organization Profile ##
```powershell
Get-PCOrganizationProfile
```

Просмотреть файл

@ -0,0 +1,7 @@
# Get-PCResellerCustomer (indirect model only) #
## Get all indirect resellers ##
```powershell
Get-PCResellerCustomer -resellerId '<reseller guid>'
```

Просмотреть файл

@ -1,9 +1,9 @@
# Partner Center PowerShell Module (preview) #
# Get-PCResellerCustomers (indirect model only) #
## Get-PCResellerCustomers (indirect model only) ##
## Deprecated: Use Get-PCResellerCustomer instead ##
## Get all indirect resellers ##
**Get all indirect resellers**
```powershell
Get-PCResellerCustomers -resellerId '<reseller guid>'
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCSR #
## Get-PCSR ##
**Get all Service Requests**
## Get all service requests ##
```powershell
Get-PCSR -all
```
**Get a specific Service Request**
## Get a specific service request ##
```powershell
Get-PCSR -srid '<service request id GUID>'
```
**Get all customer Service Requests**
## Get all customer service requests ##
```powershell
Get-PCSR -tenantid '<tenant id GUID>'
```

Просмотреть файл

@ -0,0 +1,9 @@
# Get-PCSRTopic #
This cmdlet requires App+User authentication
## Get all topics available for Service Requests ##
```powershell
Get-PCSRTopic
```

Просмотреть файл

@ -1,9 +1,9 @@
# Partner Center PowerShell Module (preview) #
# Get-PCSRTopics #
## Get-PCSRTopics ##
## Deprecated: Use Get-PCSRTopic instead ##
**Get all topics available for Service Requests**
## Get all topics available for Service Requests ##
```powershell
Get-PCSRTopics
```

Просмотреть файл

@ -0,0 +1,13 @@
# Get-PCSubscribedSKU #
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
## Get a list of available licenses ##
```powershell
Get-PCSubscribedSKU -tenantid $customer.id
```

Просмотреть файл

@ -1,13 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Get-PCSubscribedSKUs #
## Get-PCSubscribedSKUs ##
## Deprecated: Use Get-PCSubscribedSKU instead ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get a list of available licenses**
## Get a list of available licenses ##
```powershell
Get-PCSubscribedSKUs -tenantid $customer.id
```

Просмотреть файл

@ -1,24 +1,31 @@
# Partner Center PowerShell Module (preview) #
# Get-PCSubscription #
## Get-PCSubscription ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get all customer subscriptions**
## Get all customer subscriptions ##
```powershell
Get-PCSubscription -tenantid $customer.id -all
```
**Get a customer subscription**
## Get a customer subscription ##
```powershell
Get-PCSubscription -tenantid $customer.id -subscriptionid '<subscription id GUID>'
```
**Get all customer subscriptions from an order**
## Get all customer subscriptions from an order ##
```powershell
Get-PCSubscription -tenantid $customer.id -orderid '<order id GUID>'
```
**Get all customer subscriptions from a reseller (available only for Distributor CSP Account)**
## Get all customer subscriptions from a reseller (available only for Distributor CSP Account) ##
```powershell
Get-PCSubscription -tenantid $customer.id -partnerid '<MPNID>'
```

Просмотреть файл

@ -1,13 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Get-PCSubscriptionMonthlyUsageRecords #
## Get-PCSubscriptionMonthlyUsageRecords ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get usage data for subscriptions**
## Get usage data for subscriptions ##
```powershell
Get-PCSubscriptionMonthlyUsageRecords -tenantid $customer.id
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Get-PCSupportProfile #
## Get-PCSupportProfile ##
**Get Partner Support Profile**
## Get Partner Support Profile ##
```powershell
Get-PCSupportProfile
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Get-PCUsage #
## Get-PCUsage ##
**Get a customer**
## Get a customer ##
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
**Get a subscription**
## Get a subscription ##
```powershell
Get-PCSubscription -all
```
**Gets the utilization records of a customer's Azure subscription for a specified time period**
## Gets the utilization records of a customer's Azure subscription for a specified period ##
```powershell
Get-PCUsage -subscriptionid $subscription.id -start_time "01-12-1999 00:00:00" -end_time "12-31-1999 00:00:00" -granularity {daily | hourly}-show_details <bool> -size <int>
```

Просмотреть файл

@ -1,20 +1,26 @@
# Partner Center PowerShell Module (preview) #
# Get-PCUsage #
## Get-PCUsage ##
**Get a customer**
## Get a customer ##
```powershell
Select-PCCustomer -tenantid '<tenant id GUID>'
```
**Get a subscription**
## Get a subscription ##
```powershell
Get-PCSubscription -all
```
**Gets first page of utilization records of a customer's Azure subscription for a specified time period**
## Gets first page of utilization records of a customer's Azure subscription for a specified period ##
```powershell
$usageData = Get-PCUsage2 -subscriptionid $subscription.id -start_time "01-12-1999 00:00:00" -end_time "31-12-1999 00:00:00" -granularity {daily | hourly}-show_details <bool> -size <int>
```
**Gets the next page of utilization records of a customer's Azure subscription for a specified time period**
## Gets the next page of utilization records of a customer's Azure subscription for a specified period ##
```powershell
# Check the Links data includes a 'next' member
$usageData = Get-PCUsage2 -continuationLink $usageData.Links
```

Просмотреть файл

@ -1,3 +1 @@
# Partner Center PowerShell Module (preview) #
## Commandlet not yet available ##
# Cmdlet not yet available #

Просмотреть файл

@ -1,9 +1,8 @@
# Partner Center PowerShell Module (preview) #
# New-PCCustomer #
## New-PCCustomer ##
Create new customer
## Create a new customer ##
```powershell
$newDefaultAddress = New-PCCustomerDefaultAddress -Country '<country code>' -Region '<region>' -City '<city>' -State '<state>' -AddressLine1 '<address1>' -PostalCode '<postal code>' -FirstName '<first name>' -LastName '<last name>' -PhoneNumber '<phone number>'
$newBillingProfile = New-PCCustomerBillingProfile -FirstName '<first name>' -LastName '<last name>' -Email '<email>' -Culture '<ex: en.us>' -Language '<ex: en>' -CompanyName '<company name>' -DefaultAddress $newDefaultAddress
@ -11,3 +10,4 @@ Create new customer
$newCompanyProfile = New-PCCustomerCompanyProfile -Domain '<company name>.onmicrosoft.com'
$newCustomer = New-PCCustomer -BillingProfile $newBillingProfile -CompanyProfile $newCompanyProfile
```

Просмотреть файл

@ -1,15 +1,16 @@
# Partner Center PowerShell Module (preview) #
# New-PCCustomerUser #
## New-PCCustomerUser ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Create a customer user**
## Create a customer user ##
```powershell
$password = '<password>'
$passwordSecure = $password | ConvertTo-SecureString -AsPlainText -Force
New-PCCustomerUser -tenantid $customer.id -usageLocation '<country code>' -userPrincipalName '<upn>' -firstName '<first name>' -lastName '<last name>' -displayName '<display name>' -forceChangePassword $true -password $passwordSecure
```

Просмотреть файл

@ -1,13 +1,14 @@
# Partner Center PowerShell Module (preview) #
# New-PCOrder #
## New-PCOrder ##
**Get a customer**
## Select a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Order a new subscription**
## Order a new subscription ##
```powershell
# Get offer
$offer = Get-PCOffer -countryid '<country two digits id>' -offerid '<offer id GUID>'
@ -21,9 +22,11 @@
# Send order
New-PCOrder -tenantid $customer.id -LineItems $lineItems
```
**Order an Addon to a subscription**
## Order an Addon to a subscription ##
```powershell
# Get subscription
$subscription = Get-PCSubscription -tenantid $customer.id -subscriptionid '<subscription id>'
@ -37,7 +40,6 @@
$order = Get-PCOrder -tenantid $customer.id -orderid $subscription.orderId
# Get the next OrderLineItem number
$newLineItemNumber = $order.lineItems.Count
# Create the addon OrderLineItem
$lineItems = @()
$lineItems += [OrderLineItem]::new()
@ -49,4 +51,4 @@
# Send order
New-PCOrder -tenantid $customer.id -orderid $order.id -LineItems $lineItems
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# New-PCRelationshipRequest #
## New-PCRelationshipRequest ##
** Get invitation URL to send to customer **
## Get invitation URL to send to customer ##
```powershell
$inviteURL = (New-PCRelationshipRequest).url
```

Просмотреть файл

@ -1,17 +1,18 @@
# Partner Center PowerShell Module (preview) #
# New-PCSAToken #
## New-PCSAToken ##
## Set a specific token for a command/function - user authentication ##
**Set a specific token for a command/function - user authentication**
```powershell
$cred = Get-Credential
$credential = Get-Credential
New-PCSAToken -cspappID '<native app id GUID>' -cspDomain '<csp partner domain>' -credential $cred
```
New-PCSAToken -cspappID '<native app id GUID>' -cspDomain '<csp partner domain>' -credential $credential
**Set a specific token for a command/function - app authentication**
## Set a specific token for a command/function - app authentication ##
```powershell
$clientSecret = '<key code secret>'
$clientSecretSecure = $clientSecret | ConvertTo-SecureString -AsPlainText -Force
New-PCSAToken -cspappID '<native app id GUID>' -cspDomain '<csp partner domain>' -cspClientSecret $clientSecretSecure
```

Просмотреть файл

@ -1,17 +1,20 @@
# Partner Center PowerShell Module (preview) #
# New-PCSR #
## New-PCSR ##
**Get support topic for the request**
## Get support topic for the request ##
```powershell
$supportTopic = Get-PCSRTopics | Where-Object name -Contains '<support topic name>'
```
**New Service Requests - Sample 1**
## New Service Requests - Sample ##
```powershell
New-PCSR -title '<service request title>' -description '<service request description>' -severity '<Minimal | Moderate | Critical>' -supportTopicID '<support topic id guid>'
```
**New Service Requests - Sample 2**
## New Service Requests - Sample 2 ##
```powershell
$serviceRequestContact = [ServiceRequestContact]::new()
$serviceRequestContact.FirstName = '<first name>'
$serviceRequestContact.LastName = '<last name>'
@ -32,4 +35,4 @@
$serviceRequest.NewNote = $serviceRequestNote
New-PCSR -serviceRequest $serviceRequest
```

Просмотреть файл

@ -1,12 +1,13 @@
# Partner Center PowerShell Module (preview) #
# Remove-PCCustomer #
## Remove-PCCustomer ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Delete a customer (integration sandbox only)**
## Delete a customer (integration sandbox only) ##
```powershell
Remove-PCCustomer -tenantid $customer.id
```

Просмотреть файл

@ -1,20 +1,25 @@
# Partner Center PowerShell Module (preview) #
# Remove-PCCustomerRoleMember #
## Remove-PCCustomerRoleMember ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get a role**
## Get a role ##
```powershell
$role = Get-PCDirectoryRoles -tenantid $customer.id | Where-Object name -Contains '<role name>'
```
**Get a User**
## Get a User ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -userid '<user id guid>'
```
**Remove a User from a Role**
## Remove a User from a Role ##
```powershell
Remove-PCCustomerRoleMember -tenantid $customer.id -roleid $role.id -userid $user.id
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Remove-PCCustomerUser #
## Remove-PCCustomerUser ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer user**
## Get customer user ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -userid '<user id>'
```
**Delete a customer user**
## Delete a customer user ##
```powershell
Remove-PCCustomerUser -tenantid $customer.id -user $user
```

Просмотреть файл

@ -1,16 +1,19 @@
# Partner Center PowerShell Module (preview) #
# Restore-PCCustomerUser #
## Restore-PCCustomerUser ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer deleted users**
## Get customer deleted users ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -deleted | ? id -EQ '<user id>'
```
**Restore a customer deleted user**
## Restore a customer deleted user ##
```powershell
Restore-PCCustomerUser -tenantid $customer.id -user $user
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Set-PCBillingProfile #
## Set-PCBillingProfile ##
**Set Partner Billing Profile**
## Set Partner Billing Profile ##
```powershell
Set-PCBillingProfile -firstname '<first name>' -lastname '<last name>' -phonenumber '<phone number>' -AddressLine1 '<address 1>' -AddressLine2 '<address 2>'
```

Просмотреть файл

@ -1,19 +1,22 @@
# Partner Center PowerShell Module (preview) #
# Set-PCCustomerBillingProfile #
## Set-PCCustomerBillingProfile ##
**Get a customer**
## Specify a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer Billing Profile**
## Get customer Billing Profile ##
```powershell
$customerBillingProfile = Get-PCCustomerBillingProfile -tenantid $customer.id
```
**Set customer Billing Profile**
## Set customer Billing Profile ##
```powershell
$customerBillingProfile.firstName = '<first name>'
$customerBillingProfile.lastName = '<last name>'
$customerBillingProfile.email = '<email>'
Set-PCCustomerBillingProfile -tenantid $customer.id -billingprofile $customerBillingProfile
```

Просмотреть файл

@ -1,23 +1,28 @@
# Partner Center PowerShell Module (preview) #
# Set-PCCustomerUser #
## Set-PCCustomerUser ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get customer user**
## Get customer user ##
```powershell
$user = Get-PCCustomerUser -tenantid $customer.id -userid '<user id>'
```
**Update a customer user**
## Update a customer user ##
```powershell
Set-PCCustomerUser -tenantid $customer.id -user $user -userPrincipalName '<new UPN>'
```
**Reset a customer user password**
## Reset a customer user password ##
```powershell
$password = '<password>'
$passwordSecure = $password | ConvertTo-SecureString -AsPlainText -Force
Set-PCCustomerUser -tenantid $customer.id -user $user -password $passwordSecure -forceChangePassword $true/$false
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Set-PCLegalBusinessProfile #
## Set-PCLegalBusinessProfile ##
**Set Partner Legal Business Profile**
## Set Partner Legal Business Profile ##
```powershell
Set-PCLegalBusinessProfile -addressLine1 '<address 1>' -AddressLine2 '<address 2>' -primarycontactfirstname '<first name>' -primarycontactlastname '<last name>' -primarycontactphonenumber '<phone number>' -primarycontactemail '<email>'
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Set-PCOrganizationProfile #
## Set-PCOrganizationProfile ##
**Set Partner Organization Profile**
## Set Partner Organization Profile ##
```powershell
Set-PCOrganizationProfile -firstname '<first name>' -lastname '<last name>' -phonenumber '<phone number>'
```

Просмотреть файл

@ -1,18 +1,25 @@
# Partner Center PowerShell Module (preview) #
# Set-PCSR #
## Set-PCSR ##
**Get Service Request**
## Get Service Request ##
```powershell
$serviceRequest = Get-PCSR -serviceRequestId '<service request id guid>'
```
**Set Service Requests status**
## Set Service Requests status ##
```powershell
$serviceRequest | Set-PCSR -status '< open | closed >'
```
or
```powershell
Set-PCSR -serviceRequest $serviceRequest -status '< open | closed >'
```
**Add note to Service Requests**
## Add note to Service Requests ##
```powershell
Set-PCSR -serviceRequest $serviceRequest -addnote '<note text>'
```

Просмотреть файл

@ -1,32 +1,43 @@
# Partner Center PowerShell Module (preview) #
# Set-PCSubscription #
## Set-PCSubscription ##
**Get a customer**
## Get a customer ##
```powershell
$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
```
**Get a customer subscription**
## Get a customer subscription ##
```powershell
$subscription = Get-PCSubscription -tenantid $customer.id -subscriptionid '<subscription id GUID>'
```
**Update subscription friendly name**
## Update subscription friendly name ##
```powershell
$subscription | Set-PCSubscription -tenantid $customer.id -friendlyName '<friendly name>'
```
**Update subscription seats (license based only)**
## Update subscription seats (license based only) ##
```powershell
$subscription | Set-PCSubscription -tenantid $customer.id -quantity <seats number>
```
**Change subscription auto renewal**
## Change subscription auto renewal ##
```powershell
$subscription | Set-PCSubscription -tenantid $customer.id -AutoRenewEnabled disabled
```
**Suspend a subscription**
## Suspend a subscription ##
```powershell
$subscription | Set-PCSubscription -tenantid $customer.id -status suspended
```
**Activate a subscription**
## Activate a subscription ##
```powershell
$subscription | Set-PCSubscription -tenantid $customer.id -status active
```

Просмотреть файл

@ -1,8 +1,7 @@
# Partner Center PowerShell Module (preview) #
# Set-PCSupportProfile #
## Set-PCSupportProfile ##
**Set Partner Support Profile**
## Set Partner Support Profile ##
```powershell
Set-PCSupportProfile -website '<url>' -email '<email>' -phone '<phone number>'
```

Просмотреть файл

@ -1,14 +1,15 @@
# Partner Center PowerShell Module (preview) #
# Test-PCAddress #
## Test-PCAddress ##
**Test the country rules for an address**
## Test the country rules for an address ##
```powershell
$address = New-PCAddress -AddressLine1 '<string>' -AddressLine2 '<string>' -City '<string>' -State '<string>' -PostalCode '<string>' -country 'two digits country code' -region '<string>'
Test-PCAddress -Address <DefaultAddress>
```
or
```powershell
Test-PCAddress -AddressLine1 '<string>' -AddressLine2 '<string>' -City '<string>' -State '<string>' -PostalCode '<string>' -country 'two digits country code' -region '<string>'
```

Просмотреть файл

@ -1,5 +1,5 @@
### Expected behavior
# Expected behavior
### Actual behavior
## Actual behavior
### Steps to reproduce the problem
## Steps to reproduce the problem

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCLicensesDeployment
{
@ -20,7 +19,26 @@ function Get-PCLicensesDeployment
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCLicensesDeployment is deprecated and will not be available in future releases, use Get-PCLicenseDeployment instead."
$url = "https://api.partnercenter.microsoft.com/v1/analytics/licenses/deployment"
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj = @() + $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "PartnerLicensesDeploymentInsights")
}
# Add non-plural noun version of cmdlet. Get-PCLicensesDeployment will be removed in future releases.
function Get-PCLicenseDeployment
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
$url = "https://api.partnercenter.microsoft.com/v1/analytics/licenses/deployment"
$headers = @{Authorization="Bearer $satoken"}
@ -37,7 +55,8 @@ function Get-PCLicensesUsage
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCLicensesUsage is deprecated and will not be available in future releases, use Get-PCLicenseUsage instead."
$url = "https://api.partnercenter.microsoft.com/v1/analytics/licenses/usage"
$headers = @{Authorization="Bearer $satoken"}
@ -47,6 +66,24 @@ function Get-PCLicensesUsage
return (_formatResult -obj $obj -type "PartnerLicensesUsageInsights")
}
# Add non-plural noun version of cmdlet. Get-PCLicenseUsage cmdlet will be removed in future releases.
function Get-PCLicenseUsage
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
$url = "https://api.partnercenter.microsoft.com/v1/analytics/licenses/usage"
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj = @() + $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "PartnerLicensesUsageInsights")
}
function Get-PCCustomerLicensesDeployment
{
[CmdletBinding()]
@ -56,7 +93,27 @@ function Get-PCCustomerLicensesDeployment
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCCustomerLicensesDeployment is deprecated and will not be available in future releases, use Get-PCCustomerLicenseDeployment instead."
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/analytics/licenses/deployment" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj = @() + $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "CustomerLicensesDeploymentInsights")
}
# Add non-plural noun version of cmdlet. Get-PCCustomerLicensesDeployment will be removed in future releases.
function Get-PCCustomerLicenseDeployment
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)][String]$tenantid = $GlobalCustomerID,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/analytics/licenses/deployment" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
@ -75,7 +132,27 @@ function Get-PCCustomerLicensesUsage
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCCustomerLicensesUsage is deprecated and will not be available in future releases, use Get-PCCustomerLicenseUsage instead."
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/analytics/licenses/usage" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj = @() + $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "CustomerLicensesUsageInsights")
}
# Add non-plural noun version of cmdlet. Get-PCCustomerLicensesUsage will be removed in future releases.
function Get-PCCustomerLicenseUsage
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)][String]$tenantid = $GlobalCustomerID,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/analytics/licenses/usage" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}

Просмотреть файл

@ -11,7 +11,6 @@
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-GraphAADTokenByUser
{
@ -64,6 +63,7 @@ function Add-PCAuthentication
$resource = 'https://api.partnercenter.microsoft.com'
$AADToken = Get-GraphAADTokenByUser -resource $resource -domain $cspDomain -clientid $cspAppID -credential $credential
$cspUsername = $credential.UserName
# Get SA token
try {
$SAToken = Get-SAToken -aadtoken $AADToken -global $true
@ -103,8 +103,6 @@ function Add-PCAuthentication
"app" { $result = Add-AuthenticationBySecret -cspAppID $cspAppID -cspDomain $cspDomain -cspClientSecret $cspClientSecret }
}
Update-ModuleTelemetry -cspDomain $result.Domain
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
return $result
}
@ -164,7 +162,5 @@ function New-PCSAToken
$result = $result_arr[0]}
}
Update-ModuleTelemetry -cspDomain $result_arr[1].Domain
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
return $result
}

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCCustomer
{
@ -25,7 +24,6 @@ function Get-PCCustomer
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
function Private:Get-CustomerAllInner ($satoken)
{
@ -97,7 +95,8 @@ function Get-PCSubscribedSKUs
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCSubscribedSKUs is deprecated and will not be available in future releases, use Get-PCSubscribedSKU instead."
$obj = @()
@ -109,6 +108,26 @@ function Get-PCSubscribedSKUs
return (_formatResult -obj $obj -type "SubscribedSku")
}
# Add non-plural version of cmdlet. The plural version will be removed in future releases.
function Get-PCSubscribedSKU
{
[CmdletBinding()]
param ([Parameter(Mandatory = $false)][String]$tenantid=$GlobalCustomerID,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/subscribedskus" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "SubscribedSku")
}
function Get-PCSpendingBudget
{
[CmdletBinding()]
@ -116,7 +135,7 @@ function Get-PCSpendingBudget
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/usagebudget" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
@ -133,7 +152,6 @@ function Set-PCSpendingBudget
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/usagebudget" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
@ -167,7 +185,7 @@ function New-PCCustomer
[Parameter(ParameterSetName='ByProfiles',Mandatory = $true)][CompanyProfile] $CompanyProfile,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers"
@ -195,9 +213,6 @@ function Remove-PCCustomer
[CmdletBinding()]
param ($tenantid, [Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}" -f $tenantid
$headers = @{"Authorization"="Bearer $satoken"}
@ -221,7 +236,27 @@ function Get-PCManagedServices
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCManagedServices is deprecated and will not be available in future releases, use Get-PCManagedService instead."
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/managedservices" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
$obj = @()
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "ManagedServices")
}
# Adding non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future versions.
function Get-PCManagedService
{
[CmdletBinding()]
param ([Parameter(Mandatory = $false)][String]$tenantid=$GlobalCustomerID,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/managedservices" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
@ -240,7 +275,6 @@ function Select-PCCustomer
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}" -f $tenantid
@ -249,14 +283,12 @@ function Select-PCCustomer
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
#setting SAToke variable as global
#setting SAToken variable as global
Set-Variable -Name "GlobalCustomerID" -Value $obj.id -Scope Global
return (_formatResult -obj $obj -type "Customer")
}
function Get-PCCustomerRelationships
{
[CmdletBinding()]
@ -264,7 +296,8 @@ function Get-PCCustomerRelationships
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCCustomerRelationships is deprecated and will not be available in future releases, use Get-PCCustomerRelationship instead."
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/relationships" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
@ -275,7 +308,23 @@ function Get-PCCustomerRelationships
return (_formatResult -obj $obj -type "PartnerRelationship")
}
# Adding non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future versions.
function Get-PCCustomerRelationship
{
[CmdletBinding()]
param ([Parameter(Mandatory = $false)][String]$tenantid=$GlobalCustomerID,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/relationships" -f $tenantid
$headers = @{Authorization="Bearer $satoken"}
$obj = @()
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "PartnerRelationship")
}
function Get-PCResellerCustomers
{
@ -287,7 +336,33 @@ function Get-PCResellerCustomers
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCResellerCustomers is deprecated and will not be available in future releases, use Get-PCResellerCustomer instead."
$obj = @()
[string]$filter = '{"Field":"IndirectReseller","Value":"' + $resellerId + '","Operator":"starts_with"}'
[Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null
$Encode = [System.Web.HttpUtility]::UrlEncode($filter)
$url = "https://api.partnercenter.microsoft.com/v1/customers?size={0}&filter={1}" -f $size,$Encode
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "Customer")
}
# Add non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future versions.
function Get-PCResellerCustomer
{
[CmdletBinding()]
Param(
[Parameter(ParameterSetName='filter', Mandatory = $true)][String]$resellerId,
[Parameter(ParameterSetName='filter', Mandatory = $false)][int]$size = 200,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
$obj = @()

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -8,9 +8,9 @@ Set-StrictMode -Version latest
profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the
sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
#>
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCDomainAvailability
{
@ -24,13 +24,14 @@ function Get-PCDomainAvailability
[string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
try
{
$url = "https://api.partnercenter.microsoft.com/v1/domains/{0}" -f $domain
$headers = @{Authorization="Bearer $GlobalToken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "HEAD" #-Debug -Verbose
$null = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "HEAD" #-Debug -Verbose
return $false
}
catch [System.Net.WebException]
{
@ -50,7 +51,7 @@ function Get-PCCustomerRole
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/directoryroles" -f $tenantid
@ -70,7 +71,6 @@ function Get-PCCustomerRoleMember
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/directoryroles/{1}/usermembers" -f $tenantid, $roleid
@ -90,7 +90,7 @@ function Add-PCCustomerRoleMember
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/directoryroles/{1}/usermembers" -f $tenantid, $roleid
@ -113,7 +113,6 @@ function Remove-PCCustomerRoleMember
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
@ -132,7 +131,7 @@ function New-PCRelationshipRequest
[CmdletBinding()]
param ([Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/relationshiprequests"

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -9,9 +9,9 @@ Set-StrictMode -Version latest
sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
#>
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCInvoice
{
@ -25,7 +25,7 @@ function Get-PCInvoice
#[Parameter(ParameterSetName='detailurl',Mandatory = $false)][switch]$detailurl
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
function Private:Get-InvoiceSummaryInner($satoken)
{
$obj = @()
@ -100,7 +100,34 @@ function Get-PCInvoiceLineItems
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCInvoiceLineItems is deprecated and will not be available in future releases, use Get-PCInvoiceLineItem instead."
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/invoices/{0}/lineitems/{1}/{2}?size={3}&offset={4}" -f $invoiceid, $billingprovider, $invoicelineitemtype, $size, $offset
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response
return (_formatResult -obj $obj -type "Invoice")
}
# Adding non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future versions.
function Get-PCInvoiceLineItem
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)][String]$invoiceid,
[Parameter(Mandatory = $true)][ValidateSet("Azure","Office")][string]$billingprovider,
[Parameter(Mandatory = $true)][ValidateSet("BillingLineItems","UsageLineItems")][string]$invoicelineitemtype,
[Parameter(Mandatory = $false)][int]$size = 200,
[Parameter(Mandatory = $false)][int]$offset = 0,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/invoices/{0}/lineitems/{1}/{2}?size={3}&offset={4}" -f $invoiceid, $billingprovider, $invoicelineitemtype, $size, $offset

Просмотреть файл

@ -18,7 +18,7 @@
RootModule = 'PartnerCenterModule.psm1'
# Version number of this module.
ModuleVersion = '0.9.0.20'
ModuleVersion = '0.9.0.21'
# ID used to uniquely identify this module
GUID = '4a0bfb55-926c-4c31-8d05-50813b31c712'
@ -30,7 +30,7 @@ Author = "Microsoft Corporation"
CompanyName = "Microsoft Corporation"
# Copyright
Copyright = "Copyright (c) 2017 Microsoft Corporation. Licensed under MIT license."
Copyright = "Copyright (c) 2018 Microsoft Corporation. Licensed under MIT license."
# Description of the functionality provided by this module
Description = 'Partner Center Powershell Module (preview)'
@ -44,14 +44,18 @@ FunctionsToExport = @('Add-PCAuthentication',
'Add-PCCustomerRoleMember',
'Get-PCAddressRulesByMarket',
'Get-PCAuditRecords',
'Get-PCAuditRecord',
'Get-PCAzureRateCard',
'Get-PCAzureResourceMonthlyUsageRecords',
'Get-PCAzureResourceMonthlyUsageRecord',
'Get-PCBillingProfile',
'Get-PCCustomer',
'Get-PCCustomerBillingProfile',
'Get-PCCustomerCompanyProfile',
'Get-PCCustomerLicensesDeployment',
'Get-PCCustomerLicensesUsage',
'Get-PCCustomerLicenseDeployment',
'Get-PCCustomerLicenseUsage',
'Get-PCCustomerServiceCostSummary',
'Get-PCCustomerUsageSummary',
'Get-PCCustomerUser',
@ -59,15 +63,18 @@ FunctionsToExport = @('Add-PCAuthentication',
'Get-PCCustomerRoleMember',
'Get-PCCustomerRole',
'Get-PCCustomerRelationships',
'Get-PCCustomerRelationship',
'Get-PCDomainAvailability',
'Get-PCGraphUser',
'Get-PCGraphUsers',
'Get-PCInvoice',
'Get-PCInvoiceLineItems',
'Get-PCInvoiceLineItem',
'Get-PCLegalBusinessProfile',
'Get-PCLicensesDeployment',
'Get-PCLicenseDeployment',
'Get-PCLicenseUsage',
'Get-PCLicensesUsage',
'Get-PCManagedServices',
'Get-PCManagedService',
'Get-PCMpnProfile',
'Get-PCOffer',
'Get-PCOfferCategoriesByMarket',
@ -77,9 +84,10 @@ FunctionsToExport = @('Add-PCAuthentication',
'Get-PCSpendingBudget',
'Get-PCSR',
'Get-PCSRTopics',
'Get-PCSRTopic',
'Get-PCSubscribedSKUs',
'Get-PCSubscribedSKU',
'Get-PCSubscription',
'Get-PCAzureResourceMonthlyUsageRecords',
'Get-PCSupportProfile',
'Get-PCUsage',
'Get-PCUsage2',
@ -99,8 +107,6 @@ FunctionsToExport = @('Add-PCAuthentication',
'Remove-PCCustomerRoleMember',
'Restore-PCCustomerUser',
'Select-PCCustomer',
'Set-PCModuleTelemetry',
'Get-PCModuleTelemetry'
'Set-PCBillingProfile',
'Set-PCCustomerBillingProfile',
'Set-PCCustomerUser',
@ -108,7 +114,9 @@ FunctionsToExport = @('Add-PCAuthentication',
'Set-PCLegalBusinessProfile',
'Set-PCOrganizationProfile',
'Get-PCIndirectResellers',
'Get-PCIndirectReseller',
'Get-PCResellerCustomers',
'Get-PCResellerCustomer',
'Set-PCSpendingBudget',
'Set-PCSR',
'Set-PCSubscription',

Просмотреть файл

@ -21,7 +21,6 @@ Import-Module "$($PSScriptRoot)\PartnerCenterOrder.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterProfiles.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterServiceRequest.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterSubscription.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterTelemetry.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterUsage.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterPartner.psm1"
Import-Module "$($PSScriptRoot)\PartnerCenterUser.psm1"
@ -432,10 +431,4 @@ class PasswordProfile
Set-Variable -Name "GlobalCustomerID" -Value "" -Scope Global -Visibility Private
Set-Variable -Name "GlobalToken" -Value "" -Scope Global -Visibility Private
#telemetry variables
Set-Variable -Name "GlobalPCPSTelemetry" -Value $true -Scope Global -Visibility Private
Set-Variable -Name "GlobalPCPSCSPDomain" -Value $null -Scope Global -Visibility Private
Set-Variable -Name "GlobalPCPSExecutionId" -Value $null -Scope Global -Visibility Private
Set-Variable -Name "GlobalPCPSModuleVersion" -Value $null -Scope Global -Visibility Private

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCOffer
{
@ -24,7 +23,6 @@ function Get-PCOffer
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
if ($offerid)
@ -74,9 +72,8 @@ function Get-PCOffer
function Get-PCOfferCategoriesByMarket
{
[CmdletBinding()]
param($countryid, [Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
param($countryid, [Parameter(Mandatory = $true)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
@ -93,7 +90,7 @@ function Get-PCAddressRulesByMarket
[CmdletBinding()]
param ($countryid, [Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/countryvalidationrules/{0}" -f $countryid
@ -109,7 +106,7 @@ function Get-PCAzureRateCard
[CmdletBinding()]
param ($currency, $region, [Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCOrder
{
@ -21,7 +20,7 @@ function Get-PCOrder
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
if ($orderid)
@ -57,7 +56,7 @@ function New-PCOrder
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$headers = @{"Authorization"="Bearer $satoken"}
@ -110,7 +109,7 @@ function New-PCAddonOrder
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/orders/{1}" -f $tenantid, $orderid

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCAuditRecords
{
@ -23,8 +22,8 @@ function Get-PCAuditRecords
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCAuditRecords is deprecated and will not be available in future releases, use Get-PCAuditRecord instead."
$obj = @()
if ($startDate) { $url = "https://api.partnercenter.microsoft.com/v1/auditrecords?startDate={0}" -f $startDate }
@ -43,6 +42,37 @@ function Get-PCAuditRecords
return (_formatResult -obj $obj -type "AuditRecord")
}
# Add non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future releases.
function Get-PCAuditRecord
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)][string]$startDate,
[Parameter(Mandatory = $false)][string]$endDate,
#[Parameter(Mandatory = $false)][string]$filter,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
$obj = @()
# TODO Only 30 days can be returned per request, limit the request to 30 days span before executing request
if ($startDate) { $url = "https://api.partnercenter.microsoft.com/v1/auditrecords?startDate={0}" -f $startDate }
if ($endDate) { $url = "https://api.partnercenter.microsoft.com/v1/auditrecords?startDate={0}&endDate={1}" -f $startDate, $endDate }
#if ($filter)
#{
# [Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null
# $filter = [System.Web.HttpUtility]::UrlEncode($filter)
# $url = "https://api.partnercenter.microsoft.com/v1/auditrecords?startDate={0}&endDate={1}&filter={2}" -f $startDate, $endDate, $filter
#}
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.items
return (_formatResult -obj $obj -type "AuditRecord")
}
function Get-PCIndirectResellers
{
@ -51,7 +81,27 @@ function Get-PCIndirectResellers
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCIndirectResellers is deprecated and will not be available in future releases, use Get-PCIndirectReseller instead."
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/relationships?relationship_type=IsIndirectCloudSolutionProviderOf"
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "PartnerRelationship")
}
# Add non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future releases.
function Get-PCIndirectReseller
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
$obj = @()

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCLegalBusinessProfile
{
@ -20,7 +19,7 @@ function Get-PCLegalBusinessProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/profiles/legalbusiness"
@ -38,7 +37,7 @@ function Get-PCOrganizationProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/profiles/organization"
@ -56,7 +55,7 @@ function Get-PCBillingProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/profiles/billing"
@ -75,7 +74,7 @@ function Get-PCMpnProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
if($mpnid)
@ -101,7 +100,7 @@ function Get-PCSupportProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/profiles/support"
@ -137,7 +136,7 @@ function Set-PCLegalBusinessProfile
#$email_approver
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$actualLegalBP = Get-PCLegalBusinessProfile -satoken $satoken
@ -183,7 +182,7 @@ function Set-PCOrganizationProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$actualOrganizationP = Get-PCOrganizationProfile -satoken $satoken
@ -231,7 +230,7 @@ function Set-PCBillingProfile
#$tax_id,$billingCurrency
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$actualBillingP = Get-PCBillingProfile -satoken $satoken
@ -268,7 +267,7 @@ function Set-PCSupportProfile
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$actualSupportProfile = Get-PCSupportProfile -satoken $satoken
@ -298,7 +297,6 @@ function Get-PCCustomerBillingProfile
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
@ -320,7 +318,7 @@ function Set-PCCustomerBillingProfile
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/profiles/billing" -f $tenantid
@ -342,7 +340,7 @@ function Get-PCCustomerCompanyProfile
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/profiles/company" -f $tenantid
@ -443,7 +441,7 @@ function Test-PCAddress
[Parameter(ParameterSetName='AllDetails',Mandatory = $true)][string] $country,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/validations/address"

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCSR
{
@ -24,7 +23,7 @@ function Get-PCSR
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$headers = @{Authorization="Bearer $satoken"}
@ -45,7 +44,9 @@ function Get-PCSRTopics
[CmdletBinding()]
param([Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCSRTopics is deprecated and will not be available in future releases, use Get-PCSRTopic instead."
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/servicerequests/supporttopics"
@ -56,6 +57,24 @@ function Get-PCSRTopics
return (_formatResult -obj $obj -type "ServiceRequestTopics")
}
# Add non-plural version of the cmdlet. The plural version will be removed in future versions.
function Get-PCSRTopic
{
[CmdletBinding()]
param([Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/servicerequests/supporttopics"
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "ServiceRequestTopics")
}
function New-PCSR
{
[CmdletBinding()]
@ -71,7 +90,7 @@ function New-PCSR
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/servicerequests/{0}" -f $agentLocale
$headers = @{Authorization="Bearer $satoken"}
@ -107,7 +126,7 @@ function Set-PCSR
[Parameter(ParameterSetName='byParam', Mandatory = $false)][string]$satoken = $GlobalToken
)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
if ($serviceRequest) {$body = $serviceRequest | ConvertTo-Json -Depth 100}

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCSubscription
{
@ -29,7 +28,7 @@ function Get-PCSubscription
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
function Private:Get-SubscriptionsAllInner ($satoken, $tenantid)
{
@ -141,7 +140,7 @@ function Set-PCSubscription
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$actualSubscription = Get-PCSubscription -satoken $satoken -tenantid $tenantid -subscriptionid $subscription.Id

Просмотреть файл

@ -1,67 +0,0 @@
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance
of the sample code and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation,
production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business
profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the
sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
#>
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
function Send-ModuleTelemetry
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)][string]$functionName
)
if ($global:GlobalPCPSTelemetry)
{
$body = New-Object System.Object
$body | Add-Member -type NoteProperty -name CSPDomain -value $global:GlobalPCPSCSPDomain
$body | Add-Member -type NoteProperty -name FunctionName -value $functionName
$body | Add-Member -type NoteProperty -name ExecutionId -value $global:GlobalPCPSExecutionId
$body | Add-Member -type NoteProperty -name SourceVersion -value $global:GlobalPCPSModuleVersion
$body = $body | ConvertTo-Json -Depth 100
$result = Invoke-RestMethod -Method Post -Uri "https://api.migaz.tools/v1/telemetry/PCPSModule" -Body $body -ContentType "application/json"
}
}
function Update-ModuleTelemetry
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)][string]$cspDomain
)
$global:GlobalPCPSCSPDomain = $cspDomain
$global:GlobalPCPSExecutionId = ([Guid]::NewGuid()).Guid
$global:GlobalPCPSModuleVersion = ((Get-Module -Name PartnerCenterModule).Version | Where-Object {$_ -GT '0.0'}).ToString()
$latestModuleVersion = Invoke-RestMethod -Method Get -Uri "https://api.migaz.tools/v1/version/PCPSModule"
if ($global:GlobalPCPSModuleVersion -ne $latestModuleVersion)
{
Write-Host "A new Partner Center PowerShell Module version ($latestModuleVersion) is available" -ForegroundColor Yellow
}
}
function Set-PCModuleTelemetry
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)][bool]$enabled
)
$global:GlobalPCPSTelemetry = $enabled
}
function Get-PCModuleTelemetry
{
return $global:GlobalPCPSTelemetry
}

Просмотреть файл

@ -11,7 +11,6 @@
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCUsage
{
@ -26,7 +25,6 @@ function Get-PCUsage
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$retObject = Get-PCUsage_implementation -subscriptionid $subscriptionid -start_time $start_time -end_time $end_time -granularity $granularity -show_details $show_details -size $size -tenantid $tenantid -satoken $satoken
@ -46,7 +44,6 @@ function Get-PCUsage2
[Parameter(Mandatory = $false, ParameterSetName = 'first')][Parameter(Mandatory = $false, ParameterSetName = 'next')][string]$satoken = $GlobalToken,
[Parameter(Mandatory = $true, ParameterSetName = 'next')]$continuationLink = $null)
_testTokenContext($satoken)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
switch ($PsCmdlet.ParameterSetName)
{
@ -77,7 +74,6 @@ function Get-PCUsage_implementation
[string]$satoken,
$continuationLink)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$urlParts = @("https://api.partnercenter.microsoft.com/v1/")
@ -144,7 +140,30 @@ function Get-PCSubscriptionMonthlyUsageRecords
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCSubscriptionMonthlyUsageRecords is deprecated and will not be available in future releases, use Get-PCSubscriptionMonthlyUsageRecord instead."
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/subscriptions/usagerecords" -f $tenantid
$headers = @{Authorization = "Bearer $satoken"}
$headers += @{"MS-RequestId" = [Guid]::NewGuid()}
$headers += @{"MS-CorrelationId" = [Guid]::NewGuid()}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "SubscriptionMonthlyUsageRecord")
}
# Adding non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future versions.
function Get-PCSubscriptionMonthlyUsageRecord
{
[CmdletBinding()]
param ([Parameter(Mandatory = $false)][String]$tenantid = $GlobalCustomerID,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/subscriptions/usagerecords" -f $tenantid
@ -166,7 +185,9 @@ function Get-PCAzureResourceMonthlyUsageRecords
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCAzureResourceMonthlyUsageRecords is deprecated and will not be available in future releases, use Get-PCAzureResourceMonthlyUsageRecord instead."
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/subscriptions/{1}/usagerecords/resources" -f $tenantid, $subscriptionid
@ -179,6 +200,30 @@ function Get-PCAzureResourceMonthlyUsageRecords
return (_formatResult -obj $obj -type "AzureResourceMonthlyUsageRecord")
}
# Adding non-plural noun version of cmdlet. Plural version of the cmdlet will be removed in future versions.
function Get-PCAzureResourceMonthlyUsageRecord
{
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)][String]$tenantid = $GlobalCustomerID,
[string]$subscriptionid,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/subscriptions/{1}/usagerecords/resources" -f $tenantid, $subscriptionid
$headers = @{Authorization = "Bearer $satoken"}
$headers += @{"MS-RequestId" = [Guid]::NewGuid()}
$headers += @{"MS-CorrelationId" = [Guid]::NewGuid()}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "AzureResourceMonthlyUsageRecord")
}
function Get-PCCustomerUsageSummary
{
[CmdletBinding()]
@ -187,7 +232,7 @@ function Get-PCCustomerUsageSummary
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/usagesummary" -f $tenantid
@ -211,7 +256,6 @@ function Get-PCCustomerServiceCostSummary
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()

Просмотреть файл

@ -1,4 +1,4 @@
Set-StrictMode -Version latest
Set-StrictMode -Version latest
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
@ -11,7 +11,6 @@ Set-StrictMode -Version latest
# Load common code
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$here\commons.ps1"
Import-Module -FullyQualifiedName "$here\PartnerCenterTelemetry.psm1"
function Get-PCCustomerUser
{
@ -27,7 +26,6 @@ function Get-PCCustomerUser
)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
function Private:Get-CustomerAllUserInner ($satoken, $tenantid)
{
@ -118,7 +116,7 @@ function New-PCCustomerUser
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/users" -f $tenantid
@ -150,7 +148,7 @@ function Set-PCCustomerUser
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$actualUser = Get-PCCustomerUser -tenantid $tenantid -userid $user.Id -satoken $satoken
@ -186,7 +184,7 @@ function Restore-PCCustomerUser
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/users/{1}" -f $tenantid, $user.id
@ -209,7 +207,7 @@ function Remove-PCCustomerUser
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/users/{1}" -f $tenantid, $user.id
@ -230,7 +228,29 @@ function Get-PCCustomerUserRoles
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
Send-ModuleTelemetry -functionName $MyInvocation.MyCommand.Name
Write-Warning " Get-PCCustomerUserRoles is deprecated and will not be available in future releases, use Get-PCCustomerUserRole instead."
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/users/{1}/directoryroles" -f $tenantid, $user.id
$headers = @{Authorization="Bearer $satoken"}
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "CustomerUserDirectoryRoles")
}
# Adding in non-plural noun versions of the cmdlets
function Get-PCCustomerUserRole
{
[CmdletBinding()]
param ( [Parameter(Mandatory = $false)][String]$tenantid=$GlobalCustomerID,
[Parameter(Mandatory = $true,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)][PSCustomObject]$user,
[Parameter(Mandatory = $false)][string]$satoken = $GlobalToken)
_testTokenContext($satoken)
_testTenantContext ($tenantid)
$obj = @()
$url = "https://api.partnercenter.microsoft.com/v1/customers/{0}/users/{1}/directoryroles" -f $tenantid, $user.id

Просмотреть файл

@ -1,4 +1,4 @@
<#
<#
© 2017 Microsoft Corporation. All rights reserved. This sample code is not supported under any Microsoft standard support program or service.
This sample code is provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation,
any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance
@ -34,7 +34,7 @@ function _testTenantContext($tenantID)
{
if ($tenantid.Length -lt 1)
{
throw ">>>Use Select-PCCustomer function to select a specific tenant or use -tenantid parameter<<<"
throw ">>> Use Select-PCCustomer function to select a specific tenant or use -tenantId parameter<<<"
}
}
@ -42,7 +42,7 @@ function _testTokenContext($satoken)
{
if ($satoken.Length -lt 1)
{
throw ">>>Use Add-PCAuthentication function to login to partnercenter or use -satoken parameter<<<"
throw ">>> Use Add-PCAuthentication function to login to partnercenter or use -saToken parameter<<<"
}
}
@ -64,7 +64,7 @@ function Get-SAToken
$response = Invoke-RestMethod -Uri $url -ContentType "application/x-www-form-urlencoded" -Headers $headers -Body $body -method "POST" #-Debug -Verbose
#setting SAToke variable as global
#setting SAToken variable as global
if ($global){
Set-Variable -Name "GlobalToken" -Value $response.access_token -Scope Global
}

Просмотреть файл

@ -1,4 +1,4 @@
# Partner Center PowerShell Module (preview) #
# Partner Center PowerShell Module #
## Introduction ##
@ -60,10 +60,10 @@ After completing these steps you are ready to start using the cmdlets for the sc
|:-|:-|:-|
| | | |
| **Analytics** |Retrieve analytics | |
| | [Get partner licenses deployment information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797761.aspx) | [Get-PCLicensesDeployment](./CmdletHelp/Get-PCLicensesDeployment.md) |
| | [Get partner licenses usage information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797762.aspx) | [Get-PCLicensesUsage](./CmdletHelp/Get-PCLicensesUsage.md) |
| | [Get customer licenses deployment information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797759.aspx) | [Get-PCCustomerLicensesDeployment](./CmdletHelp/Get-PCCustomerLicensesDeployment.md) |
| | [Get customer licenses usage information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797760.aspx) | [Get-PCCustomerLicensesUsage](./CmdletHelp/Get-PCCustomerLicensesUsage.md) |
| | [Get partner licenses deployment information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797761.aspx) | [Get-PCLicenseDeployment](./CmdletHelp/Get-PCLicenseDeployment.md) |
| | [Get partner licenses usage information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797762.aspx) | [Get-PCLicenseUsage](./CmdletHelp/Get-PCLicenseUsage.md) |
| | [Get customer licenses deployment information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797759.aspx) | [Get-PCCustomerLicenseDeployment](./CmdletHelp/Get-PCCustomerLicenseDeployment.md) |
| | [Get customer licenses usage information](https://msdn.microsoft.com/en-us/library/partnercenter/mt797760.aspx) | [Get-PCCustomerLicenseUsage](./CmdletHelp/Get-PCCustomerLicenseUsage.md) |
| | | |
| **Device Deployment** | Configuration policies | |
| Add, delete, update and retrieve device configuration policies | | |
@ -111,7 +111,7 @@ After completing these steps you are ready to start using the cmdlets for the sc
| | | [Get-PCCustomerRoleMember](./CmdletHelp/Get-PCCustomerRoleMember.md) |
| | [Set user roles for a customer](https://msdn.microsoft.com/en-us/library/partnercenter/mt725336.aspx) | [Add-PCCustomerRoleMember](./CmdletHelp/Add-PCCustomerRoleMember.md) |
| | [Remove a customer user from a role](https://msdn.microsoft.com/en-us/library/partnercenter/mt745131.aspx) | [Remove-PCCustomerRoleMember](./CmdletHelp/Remove-PCCustomerRoleMember.md) |
| | [Get a list of available licenses](https://msdn.microsoft.com/en-us/library/partnercenter/mt725331.aspx) | [Get-PCSubscribedSKUs](./CmdletHelp/Get-PCSubscribedSKUs.md) |
| | [Get a list of available licenses](https://msdn.microsoft.com/en-us/library/partnercenter/mt725331.aspx) | [Get-PCSubscribedSKU](./CmdletHelp/Get-PCSubscribedSKU.md) |
| | [Assign licenses to a user](https://msdn.microsoft.com/en-us/library/partnercenter/mt725326.aspx) | [NA](./CmdletHelp/NA.md) |
| | [Check which licenses are assigned to a user](https://msdn.microsoft.com/en-us/library/partnercenter/mt725327.aspx) | [Get-PCCustomerUser](./CmdletHelp/Get-PCCustomerUser.md) |
| | [Get licenses assigned to a user by license group](https://msdn.microsoft.com/en-us/library/partnercenter/mt784685.aspx) | [NA](./CmdletHelp/NA.md) |
@ -123,7 +123,7 @@ After completing these steps you are ready to start using the cmdlets for the sc
| | [Get a list of offers for a market](https://msdn.microsoft.com/en-us/library/partnercenter/mt683488.aspx) | [Get-PCOffer](./CmdletHelp/Get-PCOffer.md) |
| | [Get an offer by ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt634678.aspx) | [Get-PCOffer](./CmdletHelp/Get-PCOffer.md) |
| | [Get add-ons for an offer ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt634669.aspx) | [Get-PCOffer](./CmdletHelp/Get-PCOffer.md) |
| Create an order | | |
| | [Get a list of products](https://docs.microsoft.com/en-us/partner-center/develop/get-a-list-of-products) | [NA](.CmdletHelp/NA.md) |
| | [Create an order](https://msdn.microsoft.com/en-us/library/partnercenter/mt634667.aspx) | [New-PCOrder](./CmdletHelp/New-PCOrder.md) |
| | [Create an order for a customer of an indirect reseller](https://msdn.microsoft.com/en-us/library/partnercenter/mt808071.aspx) | [NA](./CmdletHelp/NA.md) |
| | [Get an order by ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt634679.aspx) | [Get-PCOffer](./CmdletHelp/Get-PCOffer.md) |
@ -150,14 +150,14 @@ After completing these steps you are ready to start using the cmdlets for the sc
| **Manage billing** | | |
| Get Azure rates and utilization records | | |
| | [Get prices for Microsoft Azure](https://msdn.microsoft.com/en-us/library/partnercenter/mt774619.aspx) | [Get-PCAzureRateCard](./CmdletHelp/Get-PCAzureRateCard.md) |
| | [Get a customer's utilization records for Azure](https://msdn.microsoft.com/en-us/library/partnercenter/mt791774.aspx) | [Get-PCUsage](./CmdletHelp/Get-PCUsage.md)<br/>[Get-PCUsage2](./CmdletHelp/Get-PCUsage2.md) |
| | [Get a customer's utilization records for Azure](https://msdn.microsoft.com/en-us/library/partnercenter/mt791774.aspx) | [Get-PCUsage](./CmdletHelp/Get-PCUsage.md) [Get-PCUsage2](./CmdletHelp/Get-PCUsage2.md) |
| Get invoices | | |
| | [Get the reseller's current account balance](https://msdn.microsoft.com/en-us/library/partnercenter/mt712732.aspx) | [Get-PCInvoice](./CmdletHelp/Get-PCInvoice.md) |
| | [Get invoice by ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt712734.aspx) | [Get-PCInvoice](./CmdletHelp/Get-PCInvoice.md) |
| | [Get invoice line items](https://msdn.microsoft.com/en-us/library/partnercenter/mt634696.aspx) | [Get-PCInvoiceLineItems](./CmdletHelp/Get-PCInvoiceLineItems.md) |
| | [Get invoice line items](https://msdn.microsoft.com/en-us/library/partnercenter/mt634696.aspx) | [Get-PCInvoiceLineItem](./CmdletHelp/Get-PCInvoiceLineItem.md) |
| | [Get a collection of invoices](https://msdn.microsoft.com/en-us/library/partnercenter/mt712730.aspx) | [Get-PCInvoice](./CmdletHelp/Get-PCInvoice.md) |
| Check your Azure spending budget | | |
| | [Get usage data for a subscription](https://msdn.microsoft.com/en-us/library/partnercenter/mt651646.aspx) | [Get-PCAzureResourceMonthlyUsageRecords](./CmdletHelp/Get-PCAzureResourceMonthlyUsageRecords.md) |
| | [Get usage data for a subscription](https://msdn.microsoft.com/en-us/library/partnercenter/mt651646.aspx) | [Get-PCAzureResourceMonthlyUsageRecord](./CmdletHelp/Get-PCAzureResourceMonthlyUsageRecord.md) |
| | [Get usage summary for all of a customer's subscriptions](https://msdn.microsoft.com/en-us/library/partnercenter/mt651643.aspx) | [Get-PCCustomerUsageSummary](./CmdletHelp/Get-PCCustomerUsageSummary.md) |
| Get service costs | | |
| | [Get a customer's service costs summary](https://msdn.microsoft.com/en-us/library/partnercenter/mt492473.aspx) | [NA](./CmdletHelp/NA.md) |
@ -165,13 +165,13 @@ After completing these steps you are ready to start using the cmdlets for the sc
| | | |
| **Provide support** | | |
| Admin services for a customer | | |
| | [Get the managed services for a customer by ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt614220.aspx) | [Get-PCManagedServices](./CmdletHelp/Get-PCManagedServices.md) |
| | [Get the managed services for a customer by ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt614220.aspx) | [Get-PCManagedService](./CmdletHelp/Get-PCManagedService.md) |
| Manage support contacts | | |
| | [Get a subscription's support contact](https://msdn.microsoft.com/en-us/library/partnercenter/mt803173.aspx) | [NA](./CmdletHelp/NA.md) |
| | [Update a subscription's support contact](https://msdn.microsoft.com/en-us/library/partnercenter/mt803174.aspx) | [NA](./CmdletHelp/NA.md) |
| Manage service requests | | |
| | [Create a service request](https://msdn.microsoft.com/en-us/library/partnercenter/mt805812.aspx) | [New-PCSR](./CmdletHelp/New-PCSR.md) |
| | [Get service request support topics](https://msdn.microsoft.com/en-us/library/partnercenter/mt634701.aspx) | [Get-PCSRTopics](./CmdletHelp/Get-PCSRTopics.md) |
| | [Get service request support topics](https://msdn.microsoft.com/en-us/library/partnercenter/mt634701.aspx) | [Get-PCSRTopic](./CmdletHelp/Get-PCSRTopic.md) |
| | [Get all service requests for a customer](https://msdn.microsoft.com/en-us/library/partnercenter/mt634674.aspx) | [Get-PCSR](./CmdletHelp/Get-PCSR.md) |
| | [Update a service request](https://msdn.microsoft.com/en-us/library/partnercenter/mt634719.aspx) | [Set-PCSR](./CmdletHelp/Set-PCSR.md) |
| | | |
@ -188,9 +188,9 @@ After completing these steps you are ready to start using the cmdlets for the sc
| | [Update an organization profile](https://msdn.microsoft.com/en-us/library/partnercenter/mt712737.aspx) | [Set-PCOrganizationProfile](./CmdletHelp/Set-PCOrganizationProfile.md) |
| | [Get partner by MPN ID](https://msdn.microsoft.com/en-us/library/partnercenter/mt634698.aspx) | [Get-PCMpnProfile](./CmdletHelp/Get-PCMpnProfile.md) |
| | [Get all subscriptions by partner](https://msdn.microsoft.com/en-us/library/partnercenter/mt634676.aspx) | [Get-PCSubscription](./CmdletHelp/Get-PCSubscription.md) |
| | [Get indirect resellers of a customer](https://msdn.microsoft.com/en-us/library/partnercenter/mt783002.aspx) | [Get-PCCustomerRelationships](./CmdletHelp/Get-PCCustomerRelationships.md) |
| | [Get customers of an indirect reseller](https://msdn.microsoft.com/en-us/library/partnercenter/mt808157.aspx) | [Get-PCResellerCustomers](./CmdletHelp/Get-PCResellerCustomers.md) |
| | [Retrieve a list of indirect resellers](https://msdn.microsoft.com/en-us/library/partnercenter/mt783004.aspx) | [Get-PCIndirectResellers](./CmdletHelp/Get-PCIndirectResellers.md) |
| | [Get indirect resellers of a customer](https://msdn.microsoft.com/en-us/library/partnercenter/mt783002.aspx) | [Get-PCCustomerRelationship](./CmdletHelp/Get-PCCustomerRelationship.md) |
| | [Get customers of an indirect reseller](https://msdn.microsoft.com/en-us/library/partnercenter/mt808157.aspx) | [Get-PCResellerCustomer](./CmdletHelp/Get-PCResellerCustomer.md) |
| | [Retrieve a list of indirect resellers](https://msdn.microsoft.com/en-us/library/partnercenter/mt783004.aspx) | [Get-PCIndirectReseller](./CmdletHelp/Get-PCIndirectReseller.md) |
| | | |
| **Utilities** | | |
| | [Validate address format](https://msdn.microsoft.com/en-us/library/partnercenter/mt797658.aspx) | [Test-PCAddress](./CmdletHelp/Test-PCAddress.md) |
@ -205,16 +205,4 @@ After completing these steps you are ready to start using the cmdlets for the sc
## Telemetry collection ##
To help us to better understand the module utilization and better prioritize development efforts we enabled telemetry collection by default.
What we collect?
- The CSP account domain
- The cmdlet name executed (only the name, no data is collected)
- The module version
If you prefer not to send this data use the following command to disable the telemetry collection:
```powershell
Set-PCModuleTelemetry -enabled $false
```
Telemetry has been removed starting in the 0.9.0.21 release.